<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP, GeneralizedNewtypeDeriving #-}</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-comment">-- | This module defines types and simple operations over constraints, as used</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- in the type-checker and constraint solver.</span><span>
</span><span id="line-7"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Tc.Types.Constraint</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-8"></span><span>        </span><span class="hs-comment">-- QCInst</span><span>
</span><span id="line-9"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#QCInst"><span class="hs-identifier">QCInst</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isPendingScInst"><span class="hs-identifier">isPendingScInst</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-10"></span><span>
</span><span id="line-11"></span><span>        </span><span class="hs-comment">-- Canonical constraints</span><span>
</span><span id="line-12"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Xi"><span class="hs-identifier">Xi</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier">Ct</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier">Cts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtIrredStatus"><span class="hs-identifier">CtIrredStatus</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#emptyCts"><span class="hs-identifier">emptyCts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#andCts"><span class="hs-identifier">andCts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#andManyCts"><span class="hs-identifier">andManyCts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#pprCts"><span class="hs-identifier">pprCts</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-13"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#singleCt"><span class="hs-identifier">singleCt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#listToCts"><span class="hs-identifier">listToCts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctsElts"><span class="hs-identifier">ctsElts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#consCts"><span class="hs-identifier">consCts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#snocCts"><span class="hs-identifier">snocCts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#extendCtsList"><span class="hs-identifier">extendCtsList</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-14"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isEmptyCts"><span class="hs-identifier">isEmptyCts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCTyEqCan"><span class="hs-identifier">isCTyEqCan</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCFunEqCan"><span class="hs-identifier">isCFunEqCan</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isPendingScDict"><span class="hs-identifier">isPendingScDict</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#superClassesMightHelp"><span class="hs-identifier">superClassesMightHelp</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#getPendingWantedScs"><span class="hs-identifier">getPendingWantedScs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-16"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCDictCan_Maybe"><span class="hs-identifier">isCDictCan_Maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCFunEqCan_maybe"><span class="hs-identifier">isCFunEqCan_maybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCNonCanonical"><span class="hs-identifier">isCNonCanonical</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isWantedCt"><span class="hs-identifier">isWantedCt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isDerivedCt"><span class="hs-identifier">isDerivedCt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isGivenCt"><span class="hs-identifier">isGivenCt</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isUserTypeErrorCt"><span class="hs-identifier">isUserTypeErrorCt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#getUserTypeErrorMsg"><span class="hs-identifier">getUserTypeErrorMsg</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier">ctEvidence</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLoc"><span class="hs-identifier">ctLoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#setCtLoc"><span class="hs-identifier">setCtLoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctPred"><span class="hs-identifier">ctPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctFlavour"><span class="hs-identifier">ctFlavour</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEqRel"><span class="hs-identifier">ctEqRel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctOrigin"><span class="hs-identifier">ctOrigin</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvId"><span class="hs-identifier">ctEvId</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkTcEqPredLikeEv"><span class="hs-identifier">mkTcEqPredLikeEv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkNonCanonical"><span class="hs-identifier">mkNonCanonical</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkNonCanonicalCt"><span class="hs-identifier">mkNonCanonicalCt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkGivens"><span class="hs-identifier">mkGivens</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-22"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkIrredCt"><span class="hs-identifier">mkIrredCt</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvPred"><span class="hs-identifier">ctEvPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvLoc"><span class="hs-identifier">ctEvLoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvOrigin"><span class="hs-identifier">ctEvOrigin</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvEqRel"><span class="hs-identifier">ctEvEqRel</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvExpr"><span class="hs-identifier">ctEvExpr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvTerm"><span class="hs-identifier">ctEvTerm</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvCoercion"><span class="hs-identifier">ctEvCoercion</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvEvId"><span class="hs-identifier">ctEvEvId</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfCt"><span class="hs-identifier">tyCoVarsOfCt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfCts"><span class="hs-identifier">tyCoVarsOfCts</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfCtList"><span class="hs-identifier">tyCoVarsOfCtList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfCtsList"><span class="hs-identifier">tyCoVarsOfCtsList</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Hole"><span class="hs-identifier">Hole</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#HoleSort"><span class="hs-identifier">HoleSort</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isOutOfScopeHole"><span class="hs-identifier">isOutOfScopeHole</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>
</span><span id="line-30"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier">WantedConstraints</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#insolubleWC"><span class="hs-identifier">insolubleWC</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#emptyWC"><span class="hs-identifier">emptyWC</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isEmptyWC"><span class="hs-identifier">isEmptyWC</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-31"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isSolvedWC"><span class="hs-identifier">isSolvedWC</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#andWC"><span class="hs-identifier">andWC</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#unionsWC"><span class="hs-identifier">unionsWC</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkSimpleWC"><span class="hs-identifier">mkSimpleWC</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkImplicWC"><span class="hs-identifier">mkImplicWC</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-32"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#addInsols"><span class="hs-identifier">addInsols</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#dropMisleading"><span class="hs-identifier">dropMisleading</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#addSimples"><span class="hs-identifier">addSimples</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#addImplics"><span class="hs-identifier">addImplics</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#addHoles"><span class="hs-identifier">addHoles</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfWC"><span class="hs-identifier">tyCoVarsOfWC</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#dropDerivedWC"><span class="hs-identifier">dropDerivedWC</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#dropDerivedSimples"><span class="hs-identifier">dropDerivedSimples</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-34"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfWCList"><span class="hs-identifier">tyCoVarsOfWCList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#insolubleCt"><span class="hs-identifier">insolubleCt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#insolubleEqCt"><span class="hs-identifier">insolubleEqCt</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isDroppableCt"><span class="hs-identifier">isDroppableCt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#insolubleImplic"><span class="hs-identifier">insolubleImplic</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-36"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#arisesFromGivens"><span class="hs-identifier">arisesFromGivens</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Implication"><span class="hs-identifier">Implication</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#implicationPrototype"><span class="hs-identifier">implicationPrototype</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-39"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ImplicStatus"><span class="hs-identifier">ImplicStatus</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isInsolubleStatus"><span class="hs-identifier">isInsolubleStatus</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isSolvedStatus"><span class="hs-identifier">isSolvedStatus</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-40"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier">SubGoalDepth</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#initialSubGoalDepth"><span class="hs-identifier">initialSubGoalDepth</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#maxSubGoalDepth"><span class="hs-identifier">maxSubGoalDepth</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-41"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#bumpSubGoalDepth"><span class="hs-identifier">bumpSubGoalDepth</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#subGoalDepthExceeded"><span class="hs-identifier">subGoalDepthExceeded</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-42"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier">CtLoc</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLocSpan"><span class="hs-identifier">ctLocSpan</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLocEnv"><span class="hs-identifier">ctLocEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLocLevel"><span class="hs-identifier">ctLocLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLocOrigin"><span class="hs-identifier">ctLocOrigin</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-43"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLocTypeOrKind_maybe"><span class="hs-identifier">ctLocTypeOrKind_maybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLocDepth"><span class="hs-identifier">ctLocDepth</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#bumpCtLocDepth"><span class="hs-identifier">bumpCtLocDepth</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isGivenLoc"><span class="hs-identifier">isGivenLoc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-45"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#setCtLocOrigin"><span class="hs-identifier">setCtLocOrigin</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#updateCtLocOrigin"><span class="hs-identifier">updateCtLocOrigin</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#setCtLocEnv"><span class="hs-identifier">setCtLocEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#setCtLocSpan"><span class="hs-identifier">setCtLocSpan</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-46"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#pprCtLoc"><span class="hs-identifier">pprCtLoc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span>        </span><span class="hs-comment">-- CtEvidence</span><span>
</span><span id="line-49"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier">CtEvidence</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#TcEvDest"><span class="hs-identifier">TcEvDest</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-50"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkKindLoc"><span class="hs-identifier">mkKindLoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#toKindLoc"><span class="hs-identifier">toKindLoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkGivenLoc"><span class="hs-identifier">mkGivenLoc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-51"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isWanted"><span class="hs-identifier">isWanted</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isGiven"><span class="hs-identifier">isGiven</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isDerived"><span class="hs-identifier">isDerived</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isGivenOrWDeriv"><span class="hs-identifier">isGivenOrWDeriv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-52"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvRole"><span class="hs-identifier">ctEvRole</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#wrapType"><span class="hs-identifier">wrapType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavour"><span class="hs-identifier">CtFlavour</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ShadowInfo"><span class="hs-identifier">ShadowInfo</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier">ctEvFlavour</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-57"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavourRole"><span class="hs-identifier">CtFlavourRole</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvFlavourRole"><span class="hs-identifier">ctEvFlavourRole</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctFlavourRole"><span class="hs-identifier">ctFlavourRole</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-58"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanRewrite"><span class="hs-identifier">eqCanRewrite</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanRewriteFR"><span class="hs-identifier">eqCanRewriteFR</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqMayRewriteFR"><span class="hs-identifier">eqMayRewriteFR</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-59"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanDischargeFR"><span class="hs-identifier">eqCanDischargeFR</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-60"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#funEqCanDischarge"><span class="hs-identifier">funEqCanDischarge</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#funEqCanDischargeF"><span class="hs-identifier">funEqCanDischargeF</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span>        </span><span class="hs-comment">-- Pretty printing</span><span>
</span><span id="line-63"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#pprEvVarTheta"><span class="hs-identifier">pprEvVarTheta</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-64"></span><span>        </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#pprEvVars"><span class="hs-identifier">pprEvVars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#pprEvVarWithType"><span class="hs-identifier">pprEvVarWithType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span>  </span><span class="hs-special">)</span><span>
</span><span id="line-67"></span><span>  </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-71"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-72"></span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html"><span class="hs-identifier">GHC.Tc.Types</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier">TcLclEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#setLclEnvTcLevel"><span class="hs-identifier">setLclEnvTcLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#getLclEnvTcLevel"><span class="hs-identifier">getLclEnvTcLevel</span></a></span><span>
</span><span id="line-74"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#setLclEnvLoc"><span class="hs-identifier">setLclEnvLoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#getLclEnvLoc"><span class="hs-identifier">getLclEnvLoc</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-75"></span><span>
</span><span id="line-76"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html"><span class="hs-identifier">GHC.Core.Predicate</span></a></span><span>
</span><span id="line-77"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-78"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html"><span class="hs-identifier">GHC.Core.Coercion</span></a></span><span>
</span><span id="line-79"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Class.html"><span class="hs-identifier">GHC.Core.Class</span></a></span><span>
</span><span id="line-80"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-81"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.html"><span class="hs-identifier">GHC.Types.Var</span></a></span><span>
</span><span id="line-82"></span><span>
</span><span id="line-83"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span>
</span><span id="line-84"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html"><span class="hs-identifier">GHC.Tc.Types.Evidence</span></a></span><span>
</span><span id="line-85"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html"><span class="hs-identifier">GHC.Tc.Types.Origin</span></a></span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.html"><span class="hs-identifier">GHC.Core</span></a></span><span>
</span><span id="line-88"></span><span>
</span><span id="line-89"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html"><span class="hs-identifier">GHC.Core.TyCo.Ppr</span></a></span><span>
</span><span id="line-90"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html"><span class="hs-identifier">GHC.Types.Name.Occurrence</span></a></span><span>
</span><span id="line-91"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.FV.html"><span class="hs-identifier">GHC.Utils.FV</span></a></span><span>
</span><span id="line-92"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span>
</span><span id="line-93"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-94"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-95"></span><span>
</span><span id="line-96"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-97"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-98"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html"><span class="hs-identifier">GHC.Data.Bag</span></a></span><span>
</span><span id="line-99"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-100"></span><span>
</span><span id="line-101"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#msum"><span class="hs-identifier">msum</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-102"></span><span>
</span><span id="line-103"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
*                       Canonical constraints                          *
*                                                                      *
*   These are the constraints the low-level simplifier works with      *
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span class="hs-comment">-- The syntax of xi (&#958;) types:</span><span>
</span><span id="line-114"></span><span class="hs-comment">-- xi ::= a | T xis | xis -&gt; xis | ... | forall a. tau</span><span>
</span><span id="line-115"></span><span class="hs-comment">-- Two important notes:</span><span>
</span><span id="line-116"></span><span class="hs-comment">--      (i) No type families, unless we are under a ForAll</span><span>
</span><span id="line-117"></span><span class="hs-comment">--      (ii) Note that xi types can contain unexpanded type synonyms;</span><span>
</span><span id="line-118"></span><span class="hs-comment">--           however, the (transitive) expansions of those type synonyms</span><span>
</span><span id="line-119"></span><span class="hs-comment">--           will not contain any type functions, unless we are under a ForAll.</span><span>
</span><span id="line-120"></span><span class="hs-comment">-- We enforce the structure of Xi types when we flatten (GHC.Tc.Solver.Canonical)</span><span>
</span><span id="line-121"></span><span>
</span><span id="line-122"></span><span class="hs-keyword">type</span><span> </span><span id="Xi"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Xi"><span class="hs-identifier hs-var">Xi</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>       </span><span class="hs-comment">-- In many comments, &quot;xi&quot; ranges over Xi</span><span>
</span><span id="line-123"></span><span>
</span><span id="line-124"></span><span class="hs-keyword">type</span><span> </span><span id="Cts"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-var">Cts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span class="hs-keyword">data</span><span> </span><span id="Ct"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-var">Ct</span></a></span></span><span>
</span><span id="line-127"></span><span>  </span><span class="hs-comment">-- Atomic canonical constraints</span><span>
</span><span id="line-128"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="CDictCan"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CDictCan"><span class="hs-identifier hs-var">CDictCan</span></a></span></span><span> </span><span class="hs-special">{</span><span>  </span><span class="hs-comment">-- e.g.  Num xi</span><span>
</span><span id="line-129"></span><span>      </span><span id="cc_ev"><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var hs-var">cc_ev</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- See Note [Ct/evidence invariant]</span><span>
</span><span id="line-130"></span><span>
</span><span id="line-131"></span><span>      </span><span id="cc_class"><span class="annot"><span class="annottext">Ct -&gt; Class
</span><a href="GHC.Tc.Types.Constraint.html#cc_class"><span class="hs-identifier hs-var hs-var">cc_class</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-132"></span><span>      </span><span id="cc_tyargs"><span class="annot"><span class="annottext">Ct -&gt; [Xi]
</span><a href="GHC.Tc.Types.Constraint.html#cc_tyargs"><span class="hs-identifier hs-var hs-var">cc_tyargs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Xi"><span class="hs-identifier hs-type">Xi</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>   </span><span class="hs-comment">-- cc_tyargs are function-free, hence Xi</span><span>
</span><span id="line-133"></span><span>
</span><span id="line-134"></span><span>      </span><span id="cc_pend_sc"><span class="annot"><span class="annottext">Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#cc_pend_sc"><span class="hs-identifier hs-var hs-var">cc_pend_sc</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>   </span><span class="hs-comment">-- See Note [The superclass story] in GHC.Tc.Solver.Canonical</span><span>
</span><span id="line-135"></span><span>                           </span><span class="hs-comment">-- True &lt;=&gt; (a) cc_class has superclasses</span><span>
</span><span id="line-136"></span><span>                           </span><span class="hs-comment">--          (b) we have not (yet) added those</span><span>
</span><span id="line-137"></span><span>                           </span><span class="hs-comment">--              superclasses as Givens</span><span>
</span><span id="line-138"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="CIrredCan"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CIrredCan"><span class="hs-identifier hs-var">CIrredCan</span></a></span></span><span> </span><span class="hs-special">{</span><span>  </span><span class="hs-comment">-- These stand for yet-unusable predicates</span><span>
</span><span id="line-141"></span><span>      </span><span id="cc_ev"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var">cc_ev</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span class="hs-special">,</span><span>   </span><span class="hs-comment">-- See Note [Ct/evidence invariant]</span><span>
</span><span id="line-142"></span><span>      </span><span id="cc_status"><span class="annot"><span class="annottext">Ct -&gt; CtIrredStatus
</span><a href="GHC.Tc.Types.Constraint.html#cc_status"><span class="hs-identifier hs-var hs-var">cc_status</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtIrredStatus"><span class="hs-identifier hs-type">CtIrredStatus</span></a></span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span>        </span><span class="hs-comment">-- For the might-be-soluble case, the ctev_pred of the evidence is</span><span>
</span><span id="line-145"></span><span>        </span><span class="hs-comment">-- of form   (tv xi1 xi2 ... xin)   with a tyvar at the head</span><span>
</span><span id="line-146"></span><span>        </span><span class="hs-comment">--      or   (tv1 ~ ty2)   where the CTyEqCan  kind invariant (TyEq:K) fails</span><span>
</span><span id="line-147"></span><span>        </span><span class="hs-comment">--      or   (F tys ~ ty)  where the CFunEqCan kind invariant fails</span><span>
</span><span id="line-148"></span><span>        </span><span class="hs-comment">-- See Note [CIrredCan constraints]</span><span>
</span><span id="line-149"></span><span>
</span><span id="line-150"></span><span>        </span><span class="hs-comment">-- The definitely-insoluble case is for things like</span><span>
</span><span id="line-151"></span><span>        </span><span class="hs-comment">--    Int ~ Bool      tycons don't match</span><span>
</span><span id="line-152"></span><span>        </span><span class="hs-comment">--    a ~ [a]         occurs check</span><span>
</span><span id="line-153"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-154"></span><span>
</span><span id="line-155"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="CTyEqCan"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CTyEqCan"><span class="hs-identifier hs-var">CTyEqCan</span></a></span></span><span> </span><span class="hs-special">{</span><span>  </span><span class="hs-comment">-- tv ~ rhs</span><span>
</span><span id="line-156"></span><span>       </span><span class="hs-comment">-- Invariants:</span><span>
</span><span id="line-157"></span><span>       </span><span class="hs-comment">--   * See Note [inert_eqs: the inert equalities] in GHC.Tc.Solver.Monad</span><span>
</span><span id="line-158"></span><span>       </span><span class="hs-comment">--   * (TyEq:OC) tv not in deep tvs(rhs)   (occurs check)</span><span>
</span><span id="line-159"></span><span>       </span><span class="hs-comment">--   * (TyEq:F) If tv is a TauTv, then rhs has no foralls</span><span>
</span><span id="line-160"></span><span>       </span><span class="hs-comment">--       (this avoids substituting a forall for the tyvar in other types)</span><span>
</span><span id="line-161"></span><span>       </span><span class="hs-comment">--   * (TyEq:K) tcTypeKind ty `tcEqKind` tcTypeKind tv; Note [Ct kind invariant]</span><span>
</span><span id="line-162"></span><span>       </span><span class="hs-comment">--   * (TyEq:AFF) rhs (perhaps under the one cast) is *almost function-free*,</span><span>
</span><span id="line-163"></span><span>       </span><span class="hs-comment">--       See Note [Almost function-free]</span><span>
</span><span id="line-164"></span><span>       </span><span class="hs-comment">--   * (TyEq:N) If the equality is representational, rhs has no top-level newtype</span><span>
</span><span id="line-165"></span><span>       </span><span class="hs-comment">--     See Note [No top-level newtypes on RHS of representational</span><span>
</span><span id="line-166"></span><span>       </span><span class="hs-comment">--     equalities] in GHC.Tc.Solver.Canonical</span><span>
</span><span id="line-167"></span><span>       </span><span class="hs-comment">--   * (TyEq:TV) If rhs (perhaps under the cast) is also a tv, then it is oriented</span><span>
</span><span id="line-168"></span><span>       </span><span class="hs-comment">--     to give best chance of</span><span>
</span><span id="line-169"></span><span>       </span><span class="hs-comment">--     unification happening; eg if rhs is touchable then lhs is too</span><span>
</span><span id="line-170"></span><span>       </span><span class="hs-comment">--     See &quot;GHC.Tc.Solver.Canonical&quot; Note [Canonical orientation for tyvar/tyvar equality constraints]</span><span>
</span><span id="line-171"></span><span>       </span><span class="hs-comment">--   * (TyEq:H) The RHS has no blocking coercion holes. See &quot;GHC.Tc.Solver.Canonical&quot;</span><span>
</span><span id="line-172"></span><span>       </span><span class="hs-comment">--     Note [Equalities with incompatible kinds], wrinkle (2)</span><span>
</span><span id="line-173"></span><span>      </span><span id="cc_ev"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var">cc_ev</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- See Note [Ct/evidence invariant]</span><span>
</span><span id="line-174"></span><span>      </span><span id="cc_tyvar"><span class="annot"><span class="annottext">Ct -&gt; EvVar
</span><a href="GHC.Tc.Types.Constraint.html#cc_tyvar"><span class="hs-identifier hs-var hs-var">cc_tyvar</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-175"></span><span>      </span><span id="cc_rhs"><span class="annot"><span class="annottext">Ct -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#cc_rhs"><span class="hs-identifier hs-var hs-var">cc_rhs</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- Not necessarily function-free (hence not Xi)</span><span>
</span><span id="line-176"></span><span>                               </span><span class="hs-comment">-- See invariants above</span><span>
</span><span id="line-177"></span><span>
</span><span id="line-178"></span><span>      </span><span id="cc_eq_rel"><span class="annot"><span class="annottext">Ct -&gt; EqRel
</span><a href="GHC.Tc.Types.Constraint.html#cc_eq_rel"><span class="hs-identifier hs-var hs-var">cc_eq_rel</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span>       </span><span class="hs-comment">-- INVARIANT: cc_eq_rel = ctEvEqRel cc_ev</span><span>
</span><span id="line-179"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="CFunEqCan"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CFunEqCan"><span class="hs-identifier hs-var">CFunEqCan</span></a></span></span><span> </span><span class="hs-special">{</span><span>  </span><span class="hs-comment">-- F xis ~ fsk</span><span>
</span><span id="line-182"></span><span>       </span><span class="hs-comment">-- Invariants:</span><span>
</span><span id="line-183"></span><span>       </span><span class="hs-comment">--   * isTypeFamilyTyCon cc_fun</span><span>
</span><span id="line-184"></span><span>       </span><span class="hs-comment">--   * tcTypeKind (F xis) = tyVarKind fsk; Note [Ct kind invariant]</span><span>
</span><span id="line-185"></span><span>       </span><span class="hs-comment">--   * always Nominal role</span><span>
</span><span id="line-186"></span><span>      </span><span id="cc_ev"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var">cc_ev</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span class="hs-special">,</span><span>  </span><span class="hs-comment">-- See Note [Ct/evidence invariant]</span><span>
</span><span id="line-187"></span><span>      </span><span id="cc_fun"><span class="annot"><span class="annottext">Ct -&gt; TyCon
</span><a href="GHC.Tc.Types.Constraint.html#cc_fun"><span class="hs-identifier hs-var hs-var">cc_fun</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">,</span><span>       </span><span class="hs-comment">-- A type function</span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span><span>      </span><span id="cc_tyargs"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#cc_tyargs"><span class="hs-identifier hs-var">cc_tyargs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Xi"><span class="hs-identifier hs-type">Xi</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>        </span><span class="hs-comment">-- cc_tyargs are function-free (hence Xi)</span><span>
</span><span id="line-190"></span><span>        </span><span class="hs-comment">-- Either under-saturated or exactly saturated</span><span>
</span><span id="line-191"></span><span>        </span><span class="hs-comment">--    *never* over-saturated (because if so</span><span>
</span><span id="line-192"></span><span>        </span><span class="hs-comment">--    we should have decomposed)</span><span>
</span><span id="line-193"></span><span>
</span><span id="line-194"></span><span>      </span><span id="cc_fsk"><span class="annot"><span class="annottext">Ct -&gt; EvVar
</span><a href="GHC.Tc.Types.Constraint.html#cc_fsk"><span class="hs-identifier hs-var hs-var">cc_fsk</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span>  </span><span class="hs-comment">-- [G]  always a FlatSkolTv</span><span>
</span><span id="line-195"></span><span>                            </span><span class="hs-comment">-- [W], [WD], or [D] always a FlatMetaTv</span><span>
</span><span id="line-196"></span><span>        </span><span class="hs-comment">-- See Note [The flattening story] in GHC.Tc.Solver.Flatten</span><span>
</span><span id="line-197"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="CNonCanonical"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CNonCanonical"><span class="hs-identifier hs-var">CNonCanonical</span></a></span></span><span> </span><span class="hs-special">{</span><span>        </span><span class="hs-comment">-- See Note [NonCanonical Semantics] in GHC.Tc.Solver.Monad</span><span>
</span><span id="line-200"></span><span>      </span><span id="cc_ev"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var">cc_ev</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span>
</span><span id="line-201"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="CQuantCan"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CQuantCan"><span class="hs-identifier hs-var">CQuantCan</span></a></span></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#QCInst"><span class="hs-identifier hs-type">QCInst</span></a></span><span>       </span><span class="hs-comment">-- A quantified constraint</span><span>
</span><span id="line-204"></span><span>      </span><span class="hs-comment">-- NB: I expect to make more of the cases in Ct</span><span>
</span><span id="line-205"></span><span>      </span><span class="hs-comment">--     look like this, with the payload in an</span><span>
</span><span id="line-206"></span><span>      </span><span class="hs-comment">--     auxiliary type</span><span>
</span><span id="line-207"></span><span>
</span><span id="line-208"></span><span class="hs-comment">------------</span><span>
</span><span id="line-209"></span><span class="hs-keyword">data</span><span> </span><span id="QCInst"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#QCInst"><span class="hs-identifier hs-var">QCInst</span></a></span></span><span>  </span><span class="hs-comment">-- A much simplified version of ClsInst</span><span>
</span><span id="line-210"></span><span>             </span><span class="hs-comment">-- See Note [Quantified constraints] in GHC.Tc.Solver.Canonical</span><span>
</span><span id="line-211"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="QCI"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#QCI"><span class="hs-identifier hs-var">QCI</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="qci_ev"><span class="annot"><span class="annottext">QCInst -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#qci_ev"><span class="hs-identifier hs-var hs-var">qci_ev</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-comment">-- Always of type forall tvs. context =&gt; ty</span><span>
</span><span id="line-212"></span><span>                                 </span><span class="hs-comment">-- Always Given</span><span>
</span><span id="line-213"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="qci_tvs"><span class="annot"><span class="annottext">QCInst -&gt; [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#qci_tvs"><span class="hs-identifier hs-var hs-var">qci_tvs</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- The tvs</span><span>
</span><span id="line-214"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="qci_pred"><span class="annot"><span class="annottext">QCInst -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#qci_pred"><span class="hs-identifier hs-var hs-var">qci_pred</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcPredType"><span class="hs-identifier hs-type">TcPredType</span></a></span><span> </span><span class="hs-comment">-- The ty</span><span>
</span><span id="line-215"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="qci_pend_sc"><span class="annot"><span class="annottext">QCInst -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#qci_pend_sc"><span class="hs-identifier hs-var hs-var">qci_pend_sc</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>    </span><span class="hs-comment">-- Same as cc_pend_sc flag in CDictCan</span><span>
</span><span id="line-216"></span><span>                                 </span><span class="hs-comment">-- Invariant: True =&gt; qci_pred is a ClassPred</span><span>
</span><span id="line-217"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-218"></span><span>
</span><span id="line-219"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680916889"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#QCInst"><span class="hs-identifier hs-type">QCInst</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-220"></span><span>  </span><span id="local-6989586621680916886"><span class="annot"><span class="annottext">ppr :: QCInst -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#QCI"><span class="hs-identifier hs-type">QCI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">qci_ev :: QCInst -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#qci_ev"><span class="hs-identifier hs-var">qci_ev</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916884"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916884"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916884"><span class="hs-identifier hs-var">ev</span></a></span><span>
</span><span id="line-221"></span><span>
</span><span id="line-222"></span><span class="hs-comment">------------</span><span>
</span><span id="line-223"></span><span class="hs-comment">-- | A hole stores the information needed to report diagnostics</span><span>
</span><span id="line-224"></span><span class="hs-comment">-- about holes in terms (unbound identifiers or underscores) or</span><span>
</span><span id="line-225"></span><span class="hs-comment">-- in types (also called wildcards, as used in partial type</span><span>
</span><span id="line-226"></span><span class="hs-comment">-- signatures). See Note [Holes].</span><span>
</span><span id="line-227"></span><span class="hs-keyword">data</span><span> </span><span id="Hole"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Hole"><span class="hs-identifier hs-var">Hole</span></a></span></span><span>
</span><span id="line-228"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="Hole"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Hole"><span class="hs-identifier hs-var">Hole</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="hole_sort"><span class="annot"><span class="annottext">Hole -&gt; HoleSort
</span><a href="GHC.Tc.Types.Constraint.html#hole_sort"><span class="hs-identifier hs-var hs-var">hole_sort</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#HoleSort"><span class="hs-identifier hs-type">HoleSort</span></a></span><span> </span><span class="hs-comment">-- ^ What flavour of hole is this?</span><span>
</span><span id="line-229"></span><span>         </span><span class="hs-special">,</span><span> </span><span id="hole_occ"><span class="annot"><span class="annottext">Hole -&gt; OccName
</span><a href="GHC.Tc.Types.Constraint.html#hole_occ"><span class="hs-identifier hs-var hs-var">hole_occ</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccName"><span class="hs-identifier hs-type">OccName</span></a></span><span>  </span><span class="hs-comment">-- ^ The name of this hole</span><span>
</span><span id="line-230"></span><span>         </span><span class="hs-special">,</span><span> </span><span id="hole_ty"><span class="annot"><span class="annottext">Hole -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#hole_ty"><span class="hs-identifier hs-var hs-var">hole_ty</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>   </span><span class="hs-comment">-- ^ Type to be printed to the user</span><span>
</span><span id="line-231"></span><span>                                 </span><span class="hs-comment">-- For expression holes: type of expr</span><span>
</span><span id="line-232"></span><span>                                 </span><span class="hs-comment">-- For type holes: the missing type</span><span>
</span><span id="line-233"></span><span>         </span><span class="hs-special">,</span><span> </span><span id="hole_loc"><span class="annot"><span class="annottext">Hole -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#hole_loc"><span class="hs-identifier hs-var hs-var">hole_loc</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>    </span><span class="hs-comment">-- ^ Where hole was written</span><span>
</span><span id="line-234"></span><span>         </span><span class="hs-special">}</span><span>
</span><span id="line-235"></span><span>           </span><span class="hs-comment">-- For the hole_loc, we usually only want the TcLclEnv stored within.</span><span>
</span><span id="line-236"></span><span>           </span><span class="hs-comment">-- Except when we flatten, where we need a whole location. And this</span><span>
</span><span id="line-237"></span><span>           </span><span class="hs-comment">-- might get reported to the user if reducing type families in a</span><span>
</span><span id="line-238"></span><span>           </span><span class="hs-comment">-- hole type loops.</span><span>
</span><span id="line-239"></span><span>
</span><span id="line-240"></span><span>
</span><span id="line-241"></span><span class="hs-comment">-- | Used to indicate which sort of hole we have.</span><span>
</span><span id="line-242"></span><span class="hs-keyword">data</span><span> </span><span id="HoleSort"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#HoleSort"><span class="hs-identifier hs-var">HoleSort</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="ExprHole"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ExprHole"><span class="hs-identifier hs-var">ExprHole</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-243"></span><span>                 </span><span class="hs-comment">-- ^ Either an out-of-scope variable or a &quot;true&quot; hole in an</span><span>
</span><span id="line-244"></span><span>                 </span><span class="hs-comment">-- expression (TypedHoles).</span><span>
</span><span id="line-245"></span><span>                 </span><span class="hs-comment">-- The 'Id' is where to store &quot;evidence&quot;: this evidence</span><span>
</span><span id="line-246"></span><span>                 </span><span class="hs-comment">-- will be an erroring expression for -fdefer-type-errors.</span><span>
</span><span id="line-247"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span id="TypeHole"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#TypeHole"><span class="hs-identifier hs-var">TypeHole</span></a></span></span><span>
</span><span id="line-248"></span><span>                 </span><span class="hs-comment">-- ^ A hole in a type (PartialTypeSignatures)</span><span>
</span><span id="line-249"></span><span>
</span><span id="line-250"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680916873"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Hole"><span class="hs-identifier hs-type">Hole</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-251"></span><span>  </span><span id="local-6989586621680916865"><span class="annot"><span class="annottext">ppr :: Hole -&gt; SDoc
</span><a href="#local-6989586621680916865"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Hole"><span class="hs-identifier hs-type">Hole</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">hole_sort :: Hole -&gt; HoleSort
</span><a href="GHC.Tc.Types.Constraint.html#hole_sort"><span class="hs-identifier hs-var">hole_sort</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ExprHole"><span class="hs-identifier hs-type">ExprHole</span></a></span><span> </span><span id="local-6989586621680916864"><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916864"><span class="hs-identifier hs-var">id</span></a></span></span><span>
</span><span id="line-252"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">hole_occ :: Hole -&gt; OccName
</span><a href="GHC.Tc.Types.Constraint.html#hole_occ"><span class="hs-identifier hs-var">hole_occ</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916863"><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621680916863"><span class="hs-identifier hs-var">occ</span></a></span></span><span>
</span><span id="line-253"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">hole_ty :: Hole -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#hole_ty"><span class="hs-identifier hs-var">hole_ty</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916862"><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916862"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-254"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621680916863"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#colon"><span class="hs-identifier hs-var">colon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916864"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Xi -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916862"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-255"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Hole"><span class="hs-identifier hs-type">Hole</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">hole_sort :: Hole -&gt; HoleSort
</span><a href="GHC.Tc.Types.Constraint.html#hole_sort"><span class="hs-identifier hs-var">hole_sort</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HoleSort
</span><a href="GHC.Tc.Types.Constraint.html#TypeHole"><span class="hs-identifier hs-var">TypeHole</span></a></span><span>
</span><span id="line-256"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">hole_occ :: Hole -&gt; OccName
</span><a href="GHC.Tc.Types.Constraint.html#hole_occ"><span class="hs-identifier hs-var">hole_occ</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916855"><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621680916855"><span class="hs-identifier hs-var">occ</span></a></span></span><span>
</span><span id="line-257"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">hole_ty :: Hole -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#hole_ty"><span class="hs-identifier hs-var">hole_ty</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916854"><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916854"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-258"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621680916855"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#colon"><span class="hs-identifier hs-var">colon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Xi -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916854"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-259"></span><span>
</span><span id="line-260"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680916851"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#HoleSort"><span class="hs-identifier hs-type">HoleSort</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-261"></span><span>  </span><span id="local-6989586621680916849"><span class="annot"><span class="annottext">ppr :: HoleSort -&gt; SDoc
</span><a href="#local-6989586621680916849"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ExprHole"><span class="hs-identifier hs-type">ExprHole</span></a></span><span> </span><span id="local-6989586621680916848"><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916848"><span class="hs-identifier hs-var">id</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ExprHole:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916848"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-262"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">HoleSort
</span><a href="GHC.Tc.Types.Constraint.html#TypeHole"><span class="hs-identifier hs-var">TypeHole</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;TypeHole&quot;</span></span><span>
</span><span id="line-263"></span><span>
</span><span id="line-264"></span><span class="hs-comment">------------</span><span>
</span><span id="line-265"></span><span class="hs-comment">-- | Used to indicate extra information about why a CIrredCan is irreducible</span><span>
</span><span id="line-266"></span><span class="hs-keyword">data</span><span> </span><span id="CtIrredStatus"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtIrredStatus"><span class="hs-identifier hs-var">CtIrredStatus</span></a></span></span><span>
</span><span id="line-267"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="InsolubleCIS"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#InsolubleCIS"><span class="hs-identifier hs-var">InsolubleCIS</span></a></span></span><span>   </span><span class="hs-comment">-- this constraint will never be solved</span><span>
</span><span id="line-268"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="BlockedCIS"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#BlockedCIS"><span class="hs-identifier hs-var">BlockedCIS</span></a></span></span><span>     </span><span class="hs-comment">-- this constraint is blocked on a coercion hole</span><span>
</span><span id="line-269"></span><span>                   </span><span class="hs-comment">-- The hole will appear in the ctEvPred of the constraint with this status</span><span>
</span><span id="line-270"></span><span>                   </span><span class="hs-comment">-- See Note [Equalities with incompatible kinds] in &quot;GHC.Tc.Solver.Canonical&quot;</span><span>
</span><span id="line-271"></span><span>                   </span><span class="hs-comment">-- Wrinkle (4a)</span><span>
</span><span id="line-272"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="OtherCIS"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#OtherCIS"><span class="hs-identifier hs-var">OtherCIS</span></a></span></span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680916841"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtIrredStatus"><span class="hs-identifier hs-type">CtIrredStatus</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-275"></span><span>  </span><span id="local-6989586621680916840"><span class="annot"><span class="annottext">ppr :: CtIrredStatus -&gt; SDoc
</span><a href="#local-6989586621680916840"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">CtIrredStatus
</span><a href="GHC.Tc.Types.Constraint.html#InsolubleCIS"><span class="hs-identifier hs-var">InsolubleCIS</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(insoluble)&quot;</span></span><span>
</span><span id="line-276"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CtIrredStatus
</span><a href="GHC.Tc.Types.Constraint.html#BlockedCIS"><span class="hs-identifier hs-var">BlockedCIS</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(blocked)&quot;</span></span><span>
</span><span id="line-277"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CtIrredStatus
</span><a href="GHC.Tc.Types.Constraint.html#OtherCIS"><span class="hs-identifier hs-var">OtherCIS</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(soluble)&quot;</span></span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span class="hs-comment">{- Note [CIrredCan constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CIrredCan constraints are used for constraints that are &quot;stuck&quot;
   - we can't solve them (yet)
   - we can't use them to solve other constraints
   - but they may become soluble if we substitute for some
     of the type variables in the constraint

Example 1:  (c Int), where c :: * -&gt; Constraint.  We can't do anything
            with this yet, but if later c := Num, *then* we can solve it

Example 2:  a ~ b, where a :: *, b :: k, where k is a kind variable
            We don't want to use this to substitute 'b' for 'a', in case
            'k' is subsequently unified with (say) *-&gt;*, because then
            we'd have ill-kinded types floating about.  Rather we want
            to defer using the equality altogether until 'k' get resolved.

Note [Ct/evidence invariant]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If  ct :: Ct, then extra fields of 'ct' cache precisely the ctev_pred field
of (cc_ev ct), and is fully rewritten wrt the substitution.   Eg for CDictCan,
   ctev_pred (cc_ev ct) = (cc_class ct) (cc_tyargs ct)
This holds by construction; look at the unique place where CDictCan is
built (in GHC.Tc.Solver.Canonical).

In contrast, the type of the evidence *term* (ctev_dest / ctev_evar) in
the evidence may *not* be fully zonked; we are careful not to look at it
during constraint solving. See Note [Evidence field of CtEvidence].

Note [Ct kind invariant]
~~~~~~~~~~~~~~~~~~~~~~~~
CTyEqCan and CFunEqCan both require that the kind of the lhs matches the kind
of the rhs. This is necessary because both constraints are used for substitutions
during solving. If the kinds differed, then the substitution would take a well-kinded
type to an ill-kinded one.

Note [Almost function-free]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
A type is *almost function-free* if it has no type functions (something that
responds True to isTypeFamilyTyCon), except (possibly)
 * under a forall, or
 * in a coercion (either in a CastTy or a CercionTy)

The RHS of a CTyEqCan must be almost function-free, invariant (TyEq:AFF).
This is for two reasons:

1. There cannot be a top-level function. If there were, the equality should
   really be a CFunEqCan, not a CTyEqCan.

2. Nested functions aren't too bad, on the other hand. However, consider this
   scenario:

     type family F a = r | r -&gt; a

     [D] F ty1 ~ fsk1
     [D] F ty2 ~ fsk2
     [D] fsk1 ~ [G Int]
     [D] fsk2 ~ [G Bool]

     type instance G Int = Char
     type instance G Bool = Char

   If it was the case that fsk1 = fsk2, then we could unifty ty1 and ty2 --
   good! They don't look equal -- but if we aggressively reduce that G Int and
   G Bool they would become equal. The &quot;almost function free&quot; makes sure that
   these redexes are exposed.

   Note that this equality does *not* depend on casts or coercions, and so
   skipping these forms is OK. In addition, the result of a type family cannot
   be a polytype, so skipping foralls is OK, too. We skip foralls because we
   want the output of the flattener to be almost function-free. See Note
   [Flattening under a forall] in GHC.Tc.Solver.Flatten.

   As I (Richard E) write this, it is unclear if the scenario pictured above
   can happen -- I would expect the G Int and G Bool to be reduced. But
   perhaps it can arise somehow, and maintaining almost function-free is cheap.

Historical note: CTyEqCans used to require only condition (1) above: that no
type family was at the top of an RHS. But work on #16512 suggested that the
injectivity checks were not complete, and adding the requirement that functions
do not appear even in a nested fashion was easy (it was already true, but
unenforced).

The almost-function-free property is checked by isAlmostFunctionFree in GHC.Tc.Utils.TcType.
The flattener (in GHC.Tc.Solver.Flatten) produces types that are almost function-free.

Note [Holes]
~~~~~~~~~~~~
This Note explains how GHC tracks *holes*.

A hole represents one of two conditions:
 - A missing bit of an expression. Example: foo x = x + _
 - A missing bit of a type. Example: bar :: Int -&gt; _

What these have in common is that both cause GHC to emit a diagnostic to the
user describing the bit that is left out.

When a hole is encountered, a new entry of type Hole is added to the ambient
WantedConstraints. The type (hole_ty) of the hole is then simplified during
solving (with respect to any Givens in surrounding implications). It is
reported with all the other errors in GHC.Tc.Errors. No type family reduction
is done on hole types; this is purely because we think it will produce
better error messages not to reduce type families. This is why the
GHC.Tc.Solver.Flatten.flattenType function uses FM_SubstOnly.

For expression holes, the user has the option of deferring errors until runtime
with -fdefer-type-errors. In this case, the hole actually has evidence: this
evidence is an erroring expression that prints an error and crashes at runtime.
The ExprHole variant of holes stores the Id that will be bound to this evidence;
during constraint generation, this Id was inserted into the expression output
by the type checker.

You might think that the type of the stored Id is the same as the type of the
hole. However, because the hole type (hole_ty) is rewritten with respect to
givens, this might not be the case. That is, the hole_ty is always (~) to the
type of the Id, but they might not be `eqType`. We need the type of the generated
evidence to match what is expected in the context of the hole, and so we must
store these types separately.

Type-level holes have no evidence at all.
-}</span><span>
</span><span id="line-400"></span><span>
</span><span id="line-401"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkNonCanonical"><span class="hs-identifier hs-type">mkNonCanonical</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span>
</span><span id="line-402"></span><span id="mkNonCanonical"><span class="annot"><span class="annottext">mkNonCanonical :: CtEvidence -&gt; Ct
</span><a href="GHC.Tc.Types.Constraint.html#mkNonCanonical"><span class="hs-identifier hs-var hs-var">mkNonCanonical</span></a></span></span><span> </span><span id="local-6989586621680916839"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916839"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CNonCanonical :: CtEvidence -&gt; Ct
</span><a href="GHC.Tc.Types.Constraint.html#CNonCanonical"><span class="hs-identifier hs-type">CNonCanonical</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_ev :: CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var">cc_ev</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916839"><span class="hs-identifier hs-var">ev</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkNonCanonicalCt"><span class="hs-identifier hs-type">mkNonCanonicalCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span>
</span><span id="line-405"></span><span id="mkNonCanonicalCt"><span class="annot"><span class="annottext">mkNonCanonicalCt :: Ct -&gt; Ct
</span><a href="GHC.Tc.Types.Constraint.html#mkNonCanonicalCt"><span class="hs-identifier hs-var hs-var">mkNonCanonicalCt</span></a></span></span><span> </span><span id="local-6989586621680916838"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916838"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CNonCanonical :: CtEvidence -&gt; Ct
</span><a href="GHC.Tc.Types.Constraint.html#CNonCanonical"><span class="hs-identifier hs-type">CNonCanonical</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_ev :: CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var">cc_ev</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var hs-var">cc_ev</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916838"><span class="hs-identifier hs-var">ct</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-406"></span><span>
</span><span id="line-407"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkIrredCt"><span class="hs-identifier hs-type">mkIrredCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtIrredStatus"><span class="hs-identifier hs-type">CtIrredStatus</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span>
</span><span id="line-408"></span><span id="mkIrredCt"><span class="annot"><span class="annottext">mkIrredCt :: CtIrredStatus -&gt; CtEvidence -&gt; Ct
</span><a href="GHC.Tc.Types.Constraint.html#mkIrredCt"><span class="hs-identifier hs-var hs-var">mkIrredCt</span></a></span></span><span> </span><span id="local-6989586621680916837"><span class="annot"><span class="annottext">CtIrredStatus
</span><a href="#local-6989586621680916837"><span class="hs-identifier hs-var">status</span></a></span></span><span> </span><span id="local-6989586621680916836"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916836"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CIrredCan :: CtEvidence -&gt; CtIrredStatus -&gt; Ct
</span><a href="GHC.Tc.Types.Constraint.html#CIrredCan"><span class="hs-identifier hs-type">CIrredCan</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_ev :: CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var">cc_ev</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916836"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cc_status :: CtIrredStatus
</span><a href="GHC.Tc.Types.Constraint.html#cc_status"><span class="hs-identifier hs-var">cc_status</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtIrredStatus
</span><a href="#local-6989586621680916837"><span class="hs-identifier hs-var">status</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-409"></span><span>
</span><span id="line-410"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkGivens"><span class="hs-identifier hs-type">mkGivens</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#EvId"><span class="hs-identifier hs-type">EvId</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-411"></span><span id="mkGivens"><span class="annot"><span class="annottext">mkGivens :: CtLoc -&gt; [EvVar] -&gt; [Ct]
</span><a href="GHC.Tc.Types.Constraint.html#mkGivens"><span class="hs-identifier hs-var hs-var">mkGivens</span></a></span></span><span> </span><span id="local-6989586621680916834"><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916834"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621680916833"><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916833"><span class="hs-identifier hs-var">ev_ids</span></a></span></span><span>
</span><span id="line-412"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(EvVar -&gt; Ct) -&gt; [EvVar] -&gt; [Ct]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar -&gt; Ct
</span><a href="#local-6989586621680916832"><span class="hs-identifier hs-var">mk</span></a></span><span> </span><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916833"><span class="hs-identifier hs-var">ev_ids</span></a></span><span>
</span><span id="line-413"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-414"></span><span>    </span><span id="local-6989586621680916832"><span class="annot"><span class="annottext">mk :: EvVar -&gt; Ct
</span><a href="#local-6989586621680916832"><span class="hs-identifier hs-var hs-var">mk</span></a></span></span><span> </span><span id="local-6989586621680916831"><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916831"><span class="hs-identifier hs-var">ev_id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; Ct
</span><a href="GHC.Tc.Types.Constraint.html#mkNonCanonical"><span class="hs-identifier hs-var">mkNonCanonical</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtGiven :: Xi -&gt; EvVar -&gt; CtLoc -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#CtGiven"><span class="hs-identifier hs-type">CtGiven</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_evar :: EvVar
</span><a href="GHC.Tc.Types.Constraint.html#ctev_evar"><span class="hs-identifier hs-var">ctev_evar</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916831"><span class="hs-identifier hs-var">ev_id</span></a></span><span>
</span><span id="line-415"></span><span>                                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ctev_pred :: Xi
</span><a href="GHC.Tc.Types.Constraint.html#ctev_pred"><span class="hs-identifier hs-var">ctev_pred</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EvVar -&gt; Xi
</span><a href="GHC.Tc.Utils.TcType.html#evVarPred"><span class="hs-identifier hs-var">evVarPred</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916831"><span class="hs-identifier hs-var">ev_id</span></a></span><span>
</span><span id="line-416"></span><span>                                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ctev_loc :: CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctev_loc"><span class="hs-identifier hs-var">ctev_loc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916834"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-417"></span><span>
</span><span id="line-418"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-type">ctEvidence</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span>
</span><span id="line-419"></span><span id="ctEvidence"><span class="annot"><span class="annottext">ctEvidence :: Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var hs-var">ctEvidence</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CQuantCan"><span class="hs-identifier hs-type">CQuantCan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#QCI"><span class="hs-identifier hs-type">QCI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">qci_ev :: QCInst -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#qci_ev"><span class="hs-identifier hs-var">qci_ev</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916825"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916825"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916825"><span class="hs-identifier hs-var">ev</span></a></span><span>
</span><span id="line-420"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span> </span><span id="local-6989586621680916824"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916824"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var hs-var">cc_ev</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916824"><span class="hs-identifier hs-var">ct</span></a></span><span>
</span><span id="line-421"></span><span>
</span><span id="line-422"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLoc"><span class="hs-identifier hs-type">ctLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>
</span><span id="line-423"></span><span id="ctLoc"><span class="annot"><span class="annottext">ctLoc :: Ct -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctLoc"><span class="hs-identifier hs-var hs-var">ctLoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctEvLoc"><span class="hs-identifier hs-var">ctEvLoc</span></a></span><span> </span><span class="annot"><span class="annottext">(CtEvidence -&gt; CtLoc) -&gt; (Ct -&gt; CtEvidence) -&gt; Ct -&gt; CtLoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span>
</span><span id="line-424"></span><span>
</span><span id="line-425"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#setCtLoc"><span class="hs-identifier hs-type">setCtLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span>
</span><span id="line-426"></span><span id="setCtLoc"><span class="annot"><span class="annottext">setCtLoc :: Ct -&gt; CtLoc -&gt; Ct
</span><a href="GHC.Tc.Types.Constraint.html#setCtLoc"><span class="hs-identifier hs-var hs-var">setCtLoc</span></a></span></span><span> </span><span id="local-6989586621680916822"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916822"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span id="local-6989586621680916821"><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916821"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916822"><span class="hs-identifier hs-var">ct</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_ev :: CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var">cc_ev</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var hs-var">cc_ev</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916822"><span class="hs-identifier hs-var">ct</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_loc :: CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctev_loc"><span class="hs-identifier hs-var">ctev_loc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916821"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-427"></span><span>
</span><span id="line-428"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctOrigin"><span class="hs-identifier hs-type">ctOrigin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#CtOrigin"><span class="hs-identifier hs-type">CtOrigin</span></a></span><span>
</span><span id="line-429"></span><span id="ctOrigin"><span class="annot"><span class="annottext">ctOrigin :: Ct -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctOrigin"><span class="hs-identifier hs-var hs-var">ctOrigin</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctLocOrigin"><span class="hs-identifier hs-var">ctLocOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">(CtLoc -&gt; CtOrigin) -&gt; (Ct -&gt; CtLoc) -&gt; Ct -&gt; CtOrigin
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctLoc"><span class="hs-identifier hs-var">ctLoc</span></a></span><span>
</span><span id="line-430"></span><span>
</span><span id="line-431"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctPred"><span class="hs-identifier hs-type">ctPred</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span>
</span><span id="line-432"></span><span class="hs-comment">-- See Note [Ct/evidence invariant]</span><span>
</span><span id="line-433"></span><span id="ctPred"><span class="annot"><span class="annottext">ctPred :: Ct -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#ctPred"><span class="hs-identifier hs-var hs-var">ctPred</span></a></span></span><span> </span><span id="local-6989586621680916819"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916819"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#ctEvPred"><span class="hs-identifier hs-var">ctEvPred</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916819"><span class="hs-identifier hs-var">ct</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-434"></span><span>
</span><span id="line-435"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvId"><span class="hs-identifier hs-type">ctEvId</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span>
</span><span id="line-436"></span><span class="hs-comment">-- The evidence Id for this Ct</span><span>
</span><span id="line-437"></span><span id="ctEvId"><span class="annot"><span class="annottext">ctEvId :: Ct -&gt; EvVar
</span><a href="GHC.Tc.Types.Constraint.html#ctEvId"><span class="hs-identifier hs-var hs-var">ctEvId</span></a></span></span><span> </span><span id="local-6989586621680916818"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916818"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; EvVar
</span><a href="GHC.Tc.Types.Constraint.html#ctEvEvId"><span class="hs-identifier hs-var">ctEvEvId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916818"><span class="hs-identifier hs-var">ct</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-438"></span><span>
</span><span id="line-439"></span><span class="hs-comment">-- | Makes a new equality predicate with the same role as the given</span><span>
</span><span id="line-440"></span><span class="hs-comment">-- evidence.</span><span>
</span><span id="line-441"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkTcEqPredLikeEv"><span class="hs-identifier hs-type">mkTcEqPredLikeEv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>
</span><span id="line-442"></span><span id="mkTcEqPredLikeEv"><span class="annot"><span class="annottext">mkTcEqPredLikeEv :: CtEvidence -&gt; Xi -&gt; Xi -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#mkTcEqPredLikeEv"><span class="hs-identifier hs-var hs-var">mkTcEqPredLikeEv</span></a></span></span><span> </span><span id="local-6989586621680916817"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916817"><span class="hs-identifier hs-var">ev</span></a></span></span><span>
</span><span id="line-443"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Xi -&gt; EqRel
</span><a href="GHC.Core.Predicate.html#predTypeEqRel"><span class="hs-identifier hs-var">predTypeEqRel</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916815"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-444"></span><span>      </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Xi -&gt; Xi -&gt; Xi
</span><a href="GHC.Core.Coercion.html#mkPrimEqPred"><span class="hs-identifier hs-var">mkPrimEqPred</span></a></span><span>
</span><span id="line-445"></span><span>      </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Xi -&gt; Xi -&gt; Xi
</span><a href="GHC.Core.Coercion.html#mkReprPrimEqPred"><span class="hs-identifier hs-var">mkReprPrimEqPred</span></a></span><span>
</span><span id="line-446"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-447"></span><span>    </span><span id="local-6989586621680916815"><span class="annot"><span class="annottext">pred :: Xi
</span><a href="#local-6989586621680916815"><span class="hs-identifier hs-var hs-var">pred</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#ctEvPred"><span class="hs-identifier hs-var">ctEvPred</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916817"><span class="hs-identifier hs-var">ev</span></a></span><span>
</span><span id="line-448"></span><span>
</span><span id="line-449"></span><span class="hs-comment">-- | Get the flavour of the given 'Ct'</span><span>
</span><span id="line-450"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctFlavour"><span class="hs-identifier hs-type">ctFlavour</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavour"><span class="hs-identifier hs-type">CtFlavour</span></a></span><span>
</span><span id="line-451"></span><span id="ctFlavour"><span class="annot"><span class="annottext">ctFlavour :: Ct -&gt; CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#ctFlavour"><span class="hs-identifier hs-var hs-var">ctFlavour</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-var">ctEvFlavour</span></a></span><span> </span><span class="annot"><span class="annottext">(CtEvidence -&gt; CtFlavour) -&gt; (Ct -&gt; CtEvidence) -&gt; Ct -&gt; CtFlavour
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span>
</span><span id="line-452"></span><span>
</span><span id="line-453"></span><span class="hs-comment">-- | Get the equality relation for the given 'Ct'</span><span>
</span><span id="line-454"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEqRel"><span class="hs-identifier hs-type">ctEqRel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span>
</span><span id="line-455"></span><span id="ctEqRel"><span class="annot"><span class="annottext">ctEqRel :: Ct -&gt; EqRel
</span><a href="GHC.Tc.Types.Constraint.html#ctEqRel"><span class="hs-identifier hs-var hs-var">ctEqRel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; EqRel
</span><a href="GHC.Tc.Types.Constraint.html#ctEvEqRel"><span class="hs-identifier hs-var">ctEvEqRel</span></a></span><span> </span><span class="annot"><span class="annottext">(CtEvidence -&gt; EqRel) -&gt; (Ct -&gt; CtEvidence) -&gt; Ct -&gt; EqRel
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span>
</span><span id="line-456"></span><span>
</span><span id="line-457"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680916808"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-458"></span><span>  </span><span id="local-6989586621680916806"><span class="annot"><span class="annottext">ppr :: Ct -&gt; SDoc
</span><a href="#local-6989586621680916806"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span id="local-6989586621680916805"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916805"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916805"><span class="hs-identifier hs-var">ct</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680916804"><span class="hs-identifier hs-var">pp_sort</span></a></span><span>
</span><span id="line-459"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-460"></span><span>      </span><span id="local-6989586621680916804"><span class="annot"><span class="annottext">pp_sort :: SDoc
</span><a href="#local-6989586621680916804"><span class="hs-identifier hs-var hs-var">pp_sort</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916805"><span class="hs-identifier hs-var">ct</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-461"></span><span>         </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CTyEqCan"><span class="hs-identifier hs-type">CTyEqCan</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;CTyEqCan&quot;</span></span><span>
</span><span id="line-462"></span><span>         </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CFunEqCan"><span class="hs-identifier hs-type">CFunEqCan</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;CFunEqCan&quot;</span></span><span>
</span><span id="line-463"></span><span>         </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CNonCanonical"><span class="hs-identifier hs-type">CNonCanonical</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;CNonCanonical&quot;</span></span><span>
</span><span id="line-464"></span><span>         </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CDictCan"><span class="hs-identifier hs-type">CDictCan</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_pend_sc :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#cc_pend_sc"><span class="hs-identifier hs-var">cc_pend_sc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916802"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680916802"><span class="hs-identifier hs-var">pend_sc</span></a></span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-465"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680916802"><span class="hs-identifier hs-var">pend_sc</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;CDictCan(psc)&quot;</span></span><span>
</span><span id="line-466"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;CDictCan&quot;</span></span><span>
</span><span id="line-467"></span><span>         </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CIrredCan"><span class="hs-identifier hs-type">CIrredCan</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_status :: Ct -&gt; CtIrredStatus
</span><a href="GHC.Tc.Types.Constraint.html#cc_status"><span class="hs-identifier hs-var">cc_status</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916801"><span class="annot"><span class="annottext">CtIrredStatus
</span><a href="#local-6989586621680916801"><span class="hs-identifier hs-var">status</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;CIrredCan&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">CtIrredStatus -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CtIrredStatus
</span><a href="#local-6989586621680916801"><span class="hs-identifier hs-var">status</span></a></span><span>
</span><span id="line-468"></span><span>         </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CQuantCan"><span class="hs-identifier hs-type">CQuantCan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#QCI"><span class="hs-identifier hs-type">QCI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">qci_pend_sc :: QCInst -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#qci_pend_sc"><span class="hs-identifier hs-var">qci_pend_sc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916800"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680916800"><span class="hs-identifier hs-var">pend_sc</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-469"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680916800"><span class="hs-identifier hs-var">pend_sc</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;CQuantCan(psc)&quot;</span></span><span>
</span><span id="line-470"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;CQuantCan&quot;</span></span><span>
</span><span id="line-471"></span><span>
</span><span id="line-472"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
        Simple functions over evidence variables
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-479"></span><span>
</span><span id="line-480"></span><span class="hs-comment">---------------- Getting free tyvars -------------------------</span><span>
</span><span id="line-481"></span><span>
</span><span id="line-482"></span><span class="hs-comment">-- | Returns free variables of constraints as a non-deterministic set</span><span>
</span><span id="line-483"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfCt"><span class="hs-identifier hs-type">tyCoVarsOfCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyCoVarSet"><span class="hs-identifier hs-type">TcTyCoVarSet</span></a></span><span>
</span><span id="line-484"></span><span id="tyCoVarsOfCt"><span class="annot"><span class="annottext">tyCoVarsOfCt :: Ct -&gt; TcTyCoVarSet
</span><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfCt"><span class="hs-identifier hs-var hs-var">tyCoVarsOfCt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FV -&gt; TcTyCoVarSet
</span><a href="GHC.Utils.FV.html#fvVarSet"><span class="hs-identifier hs-var">fvVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">(FV -&gt; TcTyCoVarSet) -&gt; (Ct -&gt; FV) -&gt; Ct -&gt; TcTyCoVarSet
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfCt"><span class="hs-identifier hs-var">tyCoFVsOfCt</span></a></span><span>
</span><span id="line-485"></span><span>
</span><span id="line-486"></span><span class="hs-comment">-- | Returns free variables of constraints as a deterministically ordered.</span><span>
</span><span id="line-487"></span><span class="hs-comment">-- list. See Note [Deterministic FV] in &quot;GHC.Utils.FV&quot;.</span><span>
</span><span id="line-488"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfCtList"><span class="hs-identifier hs-type">tyCoVarsOfCtList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyCoVar"><span class="hs-identifier hs-type">TcTyCoVar</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-489"></span><span id="tyCoVarsOfCtList"><span class="annot"><span class="annottext">tyCoVarsOfCtList :: Ct -&gt; [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfCtList"><span class="hs-identifier hs-var hs-var">tyCoVarsOfCtList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FV -&gt; [EvVar]
</span><a href="GHC.Utils.FV.html#fvVarList"><span class="hs-identifier hs-var">fvVarList</span></a></span><span> </span><span class="annot"><span class="annottext">(FV -&gt; [EvVar]) -&gt; (Ct -&gt; FV) -&gt; Ct -&gt; [EvVar]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfCt"><span class="hs-identifier hs-var">tyCoFVsOfCt</span></a></span><span>
</span><span id="line-490"></span><span>
</span><span id="line-491"></span><span class="hs-comment">-- | Returns free variables of constraints as a composable FV computation.</span><span>
</span><span id="line-492"></span><span class="hs-comment">-- See Note [Deterministic FV] in &quot;GHC.Utils.FV&quot;.</span><span>
</span><span id="line-493"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfCt"><span class="hs-identifier hs-type">tyCoFVsOfCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.FV.html#FV"><span class="hs-identifier hs-type">FV</span></a></span><span>
</span><span id="line-494"></span><span id="tyCoFVsOfCt"><span class="annot"><span class="annottext">tyCoFVsOfCt :: Ct -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfCt"><span class="hs-identifier hs-var hs-var">tyCoFVsOfCt</span></a></span></span><span> </span><span id="local-6989586621680916795"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916795"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Xi -&gt; FV
</span><a href="GHC.Core.TyCo.FVs.html#tyCoFVsOfType"><span class="hs-identifier hs-var">tyCoFVsOfType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#ctPred"><span class="hs-identifier hs-var">ctPred</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916795"><span class="hs-identifier hs-var">ct</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-495"></span><span>  </span><span class="hs-comment">-- This must consult only the ctPred, so that it gets *tidied* fvs if the</span><span>
</span><span id="line-496"></span><span>  </span><span class="hs-comment">-- constraint has been tidied. Tidying a constraint does not tidy the</span><span>
</span><span id="line-497"></span><span>  </span><span class="hs-comment">-- fields of the Ct, only the predicate in the CtEvidence.</span><span>
</span><span id="line-498"></span><span>
</span><span id="line-499"></span><span class="hs-comment">-- | Returns free variables of a bag of constraints as a non-deterministic</span><span>
</span><span id="line-500"></span><span class="hs-comment">-- set. See Note [Deterministic FV] in &quot;GHC.Utils.FV&quot;.</span><span>
</span><span id="line-501"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfCts"><span class="hs-identifier hs-type">tyCoVarsOfCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyCoVarSet"><span class="hs-identifier hs-type">TcTyCoVarSet</span></a></span><span>
</span><span id="line-502"></span><span id="tyCoVarsOfCts"><span class="annot"><span class="annottext">tyCoVarsOfCts :: Cts -&gt; TcTyCoVarSet
</span><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfCts"><span class="hs-identifier hs-var hs-var">tyCoVarsOfCts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FV -&gt; TcTyCoVarSet
</span><a href="GHC.Utils.FV.html#fvVarSet"><span class="hs-identifier hs-var">fvVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">(FV -&gt; TcTyCoVarSet) -&gt; (Cts -&gt; FV) -&gt; Cts -&gt; TcTyCoVarSet
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Cts -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfCts"><span class="hs-identifier hs-var">tyCoFVsOfCts</span></a></span><span>
</span><span id="line-503"></span><span>
</span><span id="line-504"></span><span class="hs-comment">-- | Returns free variables of a bag of constraints as a deterministically</span><span>
</span><span id="line-505"></span><span class="hs-comment">-- ordered list. See Note [Deterministic FV] in &quot;GHC.Utils.FV&quot;.</span><span>
</span><span id="line-506"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfCtsList"><span class="hs-identifier hs-type">tyCoVarsOfCtsList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyCoVar"><span class="hs-identifier hs-type">TcTyCoVar</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-507"></span><span id="tyCoVarsOfCtsList"><span class="annot"><span class="annottext">tyCoVarsOfCtsList :: Cts -&gt; [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfCtsList"><span class="hs-identifier hs-var hs-var">tyCoVarsOfCtsList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FV -&gt; [EvVar]
</span><a href="GHC.Utils.FV.html#fvVarList"><span class="hs-identifier hs-var">fvVarList</span></a></span><span> </span><span class="annot"><span class="annottext">(FV -&gt; [EvVar]) -&gt; (Cts -&gt; FV) -&gt; Cts -&gt; [EvVar]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Cts -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfCts"><span class="hs-identifier hs-var">tyCoFVsOfCts</span></a></span><span>
</span><span id="line-508"></span><span>
</span><span id="line-509"></span><span class="hs-comment">-- | Returns free variables of a bag of constraints as a composable FV</span><span>
</span><span id="line-510"></span><span class="hs-comment">-- computation. See Note [Deterministic FV] in &quot;GHC.Utils.FV&quot;.</span><span>
</span><span id="line-511"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfCts"><span class="hs-identifier hs-type">tyCoFVsOfCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.FV.html#FV"><span class="hs-identifier hs-type">FV</span></a></span><span>
</span><span id="line-512"></span><span id="tyCoFVsOfCts"><span class="annot"><span class="annottext">tyCoFVsOfCts :: Cts -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfCts"><span class="hs-identifier hs-var hs-var">tyCoFVsOfCts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Ct -&gt; FV -&gt; FV) -&gt; FV -&gt; Cts -&gt; FV
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FV -&gt; FV -&gt; FV
</span><a href="GHC.Utils.FV.html#unionFV"><span class="hs-identifier hs-var">unionFV</span></a></span><span> </span><span class="annot"><span class="annottext">(FV -&gt; FV -&gt; FV) -&gt; (Ct -&gt; FV) -&gt; Ct -&gt; FV -&gt; FV
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfCt"><span class="hs-identifier hs-var">tyCoFVsOfCt</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">FV
</span><a href="GHC.Utils.FV.html#emptyFV"><span class="hs-identifier hs-var">emptyFV</span></a></span><span>
</span><span id="line-513"></span><span>
</span><span id="line-514"></span><span class="hs-comment">-- | Returns free variables of WantedConstraints as a non-deterministic</span><span>
</span><span id="line-515"></span><span class="hs-comment">-- set. See Note [Deterministic FV] in &quot;GHC.Utils.FV&quot;.</span><span>
</span><span id="line-516"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfWC"><span class="hs-identifier hs-type">tyCoVarsOfWC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#TyCoVarSet"><span class="hs-identifier hs-type">TyCoVarSet</span></a></span><span>
</span><span id="line-517"></span><span class="hs-comment">-- Only called on *zonked* things, hence no need to worry about flatten-skolems</span><span>
</span><span id="line-518"></span><span id="tyCoVarsOfWC"><span class="annot"><span class="annottext">tyCoVarsOfWC :: WantedConstraints -&gt; TcTyCoVarSet
</span><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfWC"><span class="hs-identifier hs-var hs-var">tyCoVarsOfWC</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FV -&gt; TcTyCoVarSet
</span><a href="GHC.Utils.FV.html#fvVarSet"><span class="hs-identifier hs-var">fvVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">(FV -&gt; TcTyCoVarSet)
-&gt; (WantedConstraints -&gt; FV) -&gt; WantedConstraints -&gt; TcTyCoVarSet
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfWC"><span class="hs-identifier hs-var">tyCoFVsOfWC</span></a></span><span>
</span><span id="line-519"></span><span>
</span><span id="line-520"></span><span class="hs-comment">-- | Returns free variables of WantedConstraints as a deterministically</span><span>
</span><span id="line-521"></span><span class="hs-comment">-- ordered list. See Note [Deterministic FV] in &quot;GHC.Utils.FV&quot;.</span><span>
</span><span id="line-522"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfWCList"><span class="hs-identifier hs-type">tyCoVarsOfWCList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyCoVar"><span class="hs-identifier hs-type">TyCoVar</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-523"></span><span class="hs-comment">-- Only called on *zonked* things, hence no need to worry about flatten-skolems</span><span>
</span><span id="line-524"></span><span id="tyCoVarsOfWCList"><span class="annot"><span class="annottext">tyCoVarsOfWCList :: WantedConstraints -&gt; [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#tyCoVarsOfWCList"><span class="hs-identifier hs-var hs-var">tyCoVarsOfWCList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FV -&gt; [EvVar]
</span><a href="GHC.Utils.FV.html#fvVarList"><span class="hs-identifier hs-var">fvVarList</span></a></span><span> </span><span class="annot"><span class="annottext">(FV -&gt; [EvVar])
-&gt; (WantedConstraints -&gt; FV) -&gt; WantedConstraints -&gt; [EvVar]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfWC"><span class="hs-identifier hs-var">tyCoFVsOfWC</span></a></span><span>
</span><span id="line-525"></span><span>
</span><span id="line-526"></span><span class="hs-comment">-- | Returns free variables of WantedConstraints as a composable FV</span><span>
</span><span id="line-527"></span><span class="hs-comment">-- computation. See Note [Deterministic FV] in &quot;GHC.Utils.FV&quot;.</span><span>
</span><span id="line-528"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfWC"><span class="hs-identifier hs-type">tyCoFVsOfWC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.FV.html#FV"><span class="hs-identifier hs-type">FV</span></a></span><span>
</span><span id="line-529"></span><span class="hs-comment">-- Only called on *zonked* things, hence no need to worry about flatten-skolems</span><span>
</span><span id="line-530"></span><span id="tyCoFVsOfWC"><span class="annot"><span class="annottext">tyCoFVsOfWC :: WantedConstraints -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfWC"><span class="hs-identifier hs-var hs-var">tyCoFVsOfWC</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916784"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916784"><span class="hs-identifier hs-var">simple</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_impl :: WantedConstraints -&gt; Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916782"><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916782"><span class="hs-identifier hs-var">implic</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_holes :: WantedConstraints -&gt; Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var">wc_holes</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916780"><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916780"><span class="hs-identifier hs-var">holes</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-531"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Cts -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfCts"><span class="hs-identifier hs-var">tyCoFVsOfCts</span></a></span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916784"><span class="hs-identifier hs-var">simple</span></a></span><span> </span><span class="annot"><span class="annottext">FV -&gt; FV -&gt; FV
</span><a href="GHC.Utils.FV.html#unionFV"><span class="hs-operator hs-var">`unionFV`</span></a></span><span>
</span><span id="line-532"></span><span>    </span><span class="annot"><span class="annottext">(Implication -&gt; FV) -&gt; Bag Implication -&gt; FV
forall a. (a -&gt; FV) -&gt; Bag a -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfBag"><span class="hs-identifier hs-var">tyCoFVsOfBag</span></a></span><span> </span><span class="annot"><span class="annottext">Implication -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfImplic"><span class="hs-identifier hs-var">tyCoFVsOfImplic</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916782"><span class="hs-identifier hs-var">implic</span></a></span><span> </span><span class="annot"><span class="annottext">FV -&gt; FV -&gt; FV
</span><a href="GHC.Utils.FV.html#unionFV"><span class="hs-operator hs-var">`unionFV`</span></a></span><span>
</span><span id="line-533"></span><span>    </span><span class="annot"><span class="annottext">(Hole -&gt; FV) -&gt; Bag Hole -&gt; FV
forall a. (a -&gt; FV) -&gt; Bag a -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfBag"><span class="hs-identifier hs-var">tyCoFVsOfBag</span></a></span><span> </span><span class="annot"><span class="annottext">Hole -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfHole"><span class="hs-identifier hs-var">tyCoFVsOfHole</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916780"><span class="hs-identifier hs-var">holes</span></a></span><span>
</span><span id="line-534"></span><span>
</span><span id="line-535"></span><span class="hs-comment">-- | Returns free variables of Implication as a composable FV computation.</span><span>
</span><span id="line-536"></span><span class="hs-comment">-- See Note [Deterministic FV] in &quot;GHC.Utils.FV&quot;.</span><span>
</span><span id="line-537"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfImplic"><span class="hs-identifier hs-type">tyCoFVsOfImplic</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Implication"><span class="hs-identifier hs-type">Implication</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.FV.html#FV"><span class="hs-identifier hs-type">FV</span></a></span><span>
</span><span id="line-538"></span><span class="hs-comment">-- Only called on *zonked* things, hence no need to worry about flatten-skolems</span><span>
</span><span id="line-539"></span><span id="tyCoFVsOfImplic"><span class="annot"><span class="annottext">tyCoFVsOfImplic :: Implication -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfImplic"><span class="hs-identifier hs-var hs-var">tyCoFVsOfImplic</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Implic"><span class="hs-identifier hs-type">Implic</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ic_skols :: Implication -&gt; [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#ic_skols"><span class="hs-identifier hs-var">ic_skols</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916774"><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916774"><span class="hs-identifier hs-var">skols</span></a></span></span><span>
</span><span id="line-540"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_given :: Implication -&gt; [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#ic_given"><span class="hs-identifier hs-var">ic_given</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916772"><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916772"><span class="hs-identifier hs-var">givens</span></a></span></span><span>
</span><span id="line-541"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_wanted :: Implication -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#ic_wanted"><span class="hs-identifier hs-var">ic_wanted</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916770"><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916770"><span class="hs-identifier hs-var">wanted</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-542"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isEmptyWC"><span class="hs-identifier hs-var">isEmptyWC</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916770"><span class="hs-identifier hs-var">wanted</span></a></span><span>
</span><span id="line-543"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FV
</span><a href="GHC.Utils.FV.html#emptyFV"><span class="hs-identifier hs-var">emptyFV</span></a></span><span>
</span><span id="line-544"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-545"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[EvVar] -&gt; FV -&gt; FV
</span><a href="GHC.Core.TyCo.FVs.html#tyCoFVsVarBndrs"><span class="hs-identifier hs-var">tyCoFVsVarBndrs</span></a></span><span> </span><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916774"><span class="hs-identifier hs-var">skols</span></a></span><span>  </span><span class="annot"><span class="annottext">(FV -&gt; FV) -&gt; FV -&gt; FV
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-546"></span><span>    </span><span class="annot"><span class="annottext">[EvVar] -&gt; FV -&gt; FV
</span><a href="GHC.Core.TyCo.FVs.html#tyCoFVsVarBndrs"><span class="hs-identifier hs-var">tyCoFVsVarBndrs</span></a></span><span> </span><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916772"><span class="hs-identifier hs-var">givens</span></a></span><span> </span><span class="annot"><span class="annottext">(FV -&gt; FV) -&gt; FV -&gt; FV
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-547"></span><span>    </span><span class="annot"><span class="annottext">WantedConstraints -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfWC"><span class="hs-identifier hs-var">tyCoFVsOfWC</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916770"><span class="hs-identifier hs-var">wanted</span></a></span><span>
</span><span id="line-548"></span><span>
</span><span id="line-549"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfHole"><span class="hs-identifier hs-type">tyCoFVsOfHole</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Hole"><span class="hs-identifier hs-type">Hole</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.FV.html#FV"><span class="hs-identifier hs-type">FV</span></a></span><span>
</span><span id="line-550"></span><span id="tyCoFVsOfHole"><span class="annot"><span class="annottext">tyCoFVsOfHole :: Hole -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfHole"><span class="hs-identifier hs-var hs-var">tyCoFVsOfHole</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Hole"><span class="hs-identifier hs-type">Hole</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">hole_ty :: Hole -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#hole_ty"><span class="hs-identifier hs-var">hole_ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916768"><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916768"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Xi -&gt; FV
</span><a href="GHC.Core.TyCo.FVs.html#tyCoFVsOfType"><span class="hs-identifier hs-var">tyCoFVsOfType</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916768"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-551"></span><span>
</span><span id="line-552"></span><span id="local-6989586621680917145"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfBag"><span class="hs-identifier hs-type">tyCoFVsOfBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680917145"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.FV.html#FV"><span class="hs-identifier hs-type">FV</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680917145"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.FV.html#FV"><span class="hs-identifier hs-type">FV</span></a></span></span><span>
</span><span id="line-553"></span><span id="tyCoFVsOfBag"><span class="annot"><span class="annottext">tyCoFVsOfBag :: forall a. (a -&gt; FV) -&gt; Bag a -&gt; FV
</span><a href="GHC.Tc.Types.Constraint.html#tyCoFVsOfBag"><span class="hs-identifier hs-var hs-var">tyCoFVsOfBag</span></a></span></span><span> </span><span id="local-6989586621680916766"><span class="annot"><span class="annottext">a -&gt; FV
</span><a href="#local-6989586621680916766"><span class="hs-identifier hs-var">tvs_of</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; FV -&gt; FV) -&gt; FV -&gt; Bag a -&gt; FV
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FV -&gt; FV -&gt; FV
</span><a href="GHC.Utils.FV.html#unionFV"><span class="hs-identifier hs-var">unionFV</span></a></span><span> </span><span class="annot"><span class="annottext">(FV -&gt; FV -&gt; FV) -&gt; (a -&gt; FV) -&gt; a -&gt; FV -&gt; FV
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; FV
</span><a href="#local-6989586621680916766"><span class="hs-identifier hs-var">tvs_of</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">FV
</span><a href="GHC.Utils.FV.html#emptyFV"><span class="hs-identifier hs-var">emptyFV</span></a></span><span>
</span><span id="line-554"></span><span>
</span><span id="line-555"></span><span class="hs-comment">---------------------------</span><span>
</span><span id="line-556"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#dropDerivedWC"><span class="hs-identifier hs-type">dropDerivedWC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span>
</span><span id="line-557"></span><span class="hs-comment">-- See Note [Dropping derived constraints]</span><span>
</span><span id="line-558"></span><span id="dropDerivedWC"><span class="annot"><span class="annottext">dropDerivedWC :: WantedConstraints -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#dropDerivedWC"><span class="hs-identifier hs-var hs-var">dropDerivedWC</span></a></span></span><span> </span><span id="local-6989586621680916765"><span class="annot"><span class="annottext">wc :: WantedConstraints
</span><a href="#local-6989586621680916765"><span class="hs-identifier hs-var">wc</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916764"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916764"><span class="hs-identifier hs-var">simples</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-559"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916765"><span class="hs-identifier hs-var">wc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Cts -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#dropDerivedSimples"><span class="hs-identifier hs-var">dropDerivedSimples</span></a></span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916764"><span class="hs-identifier hs-var">simples</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-560"></span><span>    </span><span class="hs-comment">-- The wc_impl implications are already (recursively) filtered</span><span>
</span><span id="line-561"></span><span>
</span><span id="line-562"></span><span class="hs-comment">--------------------------</span><span>
</span><span id="line-563"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#dropDerivedSimples"><span class="hs-identifier hs-type">dropDerivedSimples</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span>
</span><span id="line-564"></span><span class="hs-comment">-- Drop all Derived constraints, but make [W] back into [WD],</span><span>
</span><span id="line-565"></span><span class="hs-comment">-- so that if we re-simplify these constraints we will get all</span><span>
</span><span id="line-566"></span><span class="hs-comment">-- the right derived constraints re-generated.  Forgetting this</span><span>
</span><span id="line-567"></span><span class="hs-comment">-- step led to #12936</span><span>
</span><span id="line-568"></span><span id="dropDerivedSimples"><span class="annot"><span class="annottext">dropDerivedSimples :: Cts -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#dropDerivedSimples"><span class="hs-identifier hs-var hs-var">dropDerivedSimples</span></a></span></span><span> </span><span id="local-6989586621680916763"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916763"><span class="hs-identifier hs-var">simples</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Ct -&gt; Maybe Ct) -&gt; Cts -&gt; Cts
forall a b. (a -&gt; Maybe b) -&gt; Bag a -&gt; Bag b
</span><a href="GHC.Data.Bag.html#mapMaybeBag"><span class="hs-identifier hs-var">mapMaybeBag</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Maybe Ct
</span><a href="GHC.Tc.Types.Constraint.html#dropDerivedCt"><span class="hs-identifier hs-var">dropDerivedCt</span></a></span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916763"><span class="hs-identifier hs-var">simples</span></a></span><span>
</span><span id="line-569"></span><span>
</span><span id="line-570"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#dropDerivedCt"><span class="hs-identifier hs-type">dropDerivedCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span>
</span><span id="line-571"></span><span id="dropDerivedCt"><span class="annot"><span class="annottext">dropDerivedCt :: Ct -&gt; Maybe Ct
</span><a href="GHC.Tc.Types.Constraint.html#dropDerivedCt"><span class="hs-identifier hs-var hs-var">dropDerivedCt</span></a></span></span><span> </span><span id="local-6989586621680916760"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916760"><span class="hs-identifier hs-var">ct</span></a></span></span><span>
</span><span id="line-572"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-var">ctEvFlavour</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916759"><span class="hs-identifier hs-var">ev</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-573"></span><span>      </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WOnly"><span class="hs-identifier hs-var">WOnly</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Maybe Ct
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916756"><span class="hs-identifier hs-var">ct'</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_ev :: CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var">cc_ev</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916755"><span class="hs-identifier hs-var">ev_wd</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-574"></span><span>      </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><span class="hs-identifier">_</span></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Maybe Ct
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916756"><span class="hs-identifier hs-var">ct'</span></a></span><span>
</span><span id="line-575"></span><span>      </span><span class="annot"><span class="annottext">CtFlavour
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isDroppableCt"><span class="hs-identifier hs-var">isDroppableCt</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916760"><span class="hs-identifier hs-var">ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe Ct
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-576"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Maybe Ct
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916760"><span class="hs-identifier hs-var">ct</span></a></span><span>
</span><span id="line-577"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-578"></span><span>    </span><span id="local-6989586621680916759"><span class="annot"><span class="annottext">ev :: CtEvidence
</span><a href="#local-6989586621680916759"><span class="hs-identifier hs-var hs-var">ev</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916760"><span class="hs-identifier hs-var">ct</span></a></span><span>
</span><span id="line-579"></span><span>    </span><span id="local-6989586621680916755"><span class="annot"><span class="annottext">ev_wd :: CtEvidence
</span><a href="#local-6989586621680916755"><span class="hs-identifier hs-var hs-var">ev_wd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916759"><span class="hs-identifier hs-var">ev</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_nosh :: ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#ctev_nosh"><span class="hs-identifier hs-var">ctev_nosh</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WDeriv"><span class="hs-identifier hs-var">WDeriv</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-580"></span><span>    </span><span id="local-6989586621680916756"><span class="annot"><span class="annottext">ct' :: Ct
</span><a href="#local-6989586621680916756"><span class="hs-identifier hs-var hs-var">ct'</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Ct
</span><a href="GHC.Tc.Types.Constraint.html#setPendingScDict"><span class="hs-identifier hs-var">setPendingScDict</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916760"><span class="hs-identifier hs-var">ct</span></a></span><span> </span><span class="hs-comment">-- See Note [Resetting cc_pend_sc]</span><span>
</span><span id="line-581"></span><span>
</span><span id="line-582"></span><span class="hs-comment">{- Note [Resetting cc_pend_sc]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
When we discard Derived constraints, in dropDerivedSimples, we must
set the cc_pend_sc flag to True, so that if we re-process this
CDictCan we will re-generate its derived superclasses. Otherwise
we might miss some fundeps.  #13662 showed this up.

See Note [The superclass story] in GHC.Tc.Solver.Canonical.
-}</span><span>
</span><span id="line-591"></span><span>
</span><span id="line-592"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isDroppableCt"><span class="hs-identifier hs-type">isDroppableCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-593"></span><span id="isDroppableCt"><span class="annot"><span class="annottext">isDroppableCt :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isDroppableCt"><span class="hs-identifier hs-var hs-var">isDroppableCt</span></a></span></span><span> </span><span id="local-6989586621680916751"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916751"><span class="hs-identifier hs-var">ct</span></a></span></span><span>
</span><span id="line-594"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isDerived"><span class="hs-identifier hs-var">isDerived</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916750"><span class="hs-identifier hs-var">ev</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680916747"><span class="hs-identifier hs-var">keep_deriv</span></a></span><span>
</span><span id="line-595"></span><span>    </span><span class="hs-comment">-- Drop only derived constraints, and then only if they</span><span>
</span><span id="line-596"></span><span>    </span><span class="hs-comment">-- obey Note [Dropping derived constraints]</span><span>
</span><span id="line-597"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-598"></span><span>    </span><span id="local-6989586621680916750"><span class="annot"><span class="annottext">ev :: CtEvidence
</span><a href="#local-6989586621680916750"><span class="hs-identifier hs-var hs-var">ev</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916751"><span class="hs-identifier hs-var">ct</span></a></span><span>
</span><span id="line-599"></span><span>    </span><span id="local-6989586621680916746"><span class="annot"><span class="annottext">loc :: CtLoc
</span><a href="#local-6989586621680916746"><span class="hs-identifier hs-var hs-var">loc</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctEvLoc"><span class="hs-identifier hs-var">ctEvLoc</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916750"><span class="hs-identifier hs-var">ev</span></a></span><span>
</span><span id="line-600"></span><span>    </span><span id="local-6989586621680916745"><span class="annot"><span class="annottext">orig :: CtOrigin
</span><a href="#local-6989586621680916745"><span class="hs-identifier hs-var hs-var">orig</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctLocOrigin"><span class="hs-identifier hs-var">ctLocOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916746"><span class="hs-identifier hs-var">loc</span></a></span><span>
</span><span id="line-601"></span><span>
</span><span id="line-602"></span><span>    </span><span id="local-6989586621680916747"><span class="annot"><span class="annottext">keep_deriv :: Bool
</span><a href="#local-6989586621680916747"><span class="hs-identifier hs-var hs-var">keep_deriv</span></a></span></span><span>
</span><span id="line-603"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916751"><span class="hs-identifier hs-var">ct</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-604"></span><span>          </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CIrredCan"><span class="hs-identifier hs-type">CIrredCan</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_status :: Ct -&gt; CtIrredStatus
</span><a href="GHC.Tc.Types.Constraint.html#cc_status"><span class="hs-identifier hs-var">cc_status</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtIrredStatus
</span><a href="GHC.Tc.Types.Constraint.html#InsolubleCIS"><span class="hs-identifier hs-var">InsolubleCIS</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="#local-6989586621680916744"><span class="hs-identifier hs-var">keep_eq</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-605"></span><span>          </span><span class="annot"><span class="annottext">Ct
</span><span class="hs-identifier">_</span></span><span>                                      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="#local-6989586621680916744"><span class="hs-identifier hs-var">keep_eq</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-606"></span><span>
</span><span id="line-607"></span><span>    </span><span id="local-6989586621680916744"><span class="annot"><span class="annottext">keep_eq :: Bool -&gt; Bool
</span><a href="#local-6989586621680916744"><span class="hs-identifier hs-var hs-var">keep_eq</span></a></span></span><span> </span><span id="local-6989586621680916743"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680916743"><span class="hs-identifier hs-var">definitely_insoluble</span></a></span></span><span>
</span><span id="line-608"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; Bool
</span><a href="GHC.Tc.Types.Origin.html#isGivenOrigin"><span class="hs-identifier hs-var">isGivenOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680916745"><span class="hs-identifier hs-var">orig</span></a></span><span>    </span><span class="hs-comment">-- Arising only from givens</span><span>
</span><span id="line-609"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680916743"><span class="hs-identifier hs-var">definitely_insoluble</span></a></span><span>  </span><span class="hs-comment">-- Keep only definitely insoluble</span><span>
</span><span id="line-610"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-611"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680916745"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-612"></span><span>           </span><span class="hs-comment">-- See Note [Dropping derived constraints]</span><span>
</span><span id="line-613"></span><span>           </span><span class="hs-comment">-- For fundeps, drop wanted/wanted interactions</span><span>
</span><span id="line-614"></span><span>           </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#FunDepOrigin2"><span class="hs-identifier hs-type">FunDepOrigin2</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>   </span><span class="hs-comment">-- Top-level/Wanted</span><span>
</span><span id="line-615"></span><span>           </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#FunDepOrigin1"><span class="hs-identifier hs-type">FunDepOrigin1</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680916739"><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680916739"><span class="hs-identifier hs-var">orig1</span></a></span></span><span> </span><span class="annot"><span class="annottext">RealSrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Xi
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680916738"><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680916738"><span class="hs-identifier hs-var">orig2</span></a></span></span><span> </span><span class="annot"><span class="annottext">RealSrcSpan
</span><span class="hs-identifier">_</span></span><span>
</span><span id="line-616"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680916737"><span class="hs-identifier hs-var">g1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680916735"><span class="hs-identifier hs-var">g2</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>  </span><span class="hs-comment">-- Given/Wanted errors: keep all</span><span>
</span><span id="line-617"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-comment">-- Wanted/Wanted errors: discard</span><span>
</span><span id="line-618"></span><span>             </span><span class="hs-keyword">where</span><span>
</span><span id="line-619"></span><span>               </span><span id="local-6989586621680916737"><span class="annot"><span class="annottext">g1 :: Bool
</span><a href="#local-6989586621680916737"><span class="hs-identifier hs-var hs-var">g1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; Bool
</span><a href="GHC.Tc.Types.Origin.html#isGivenOrigin"><span class="hs-identifier hs-var">isGivenOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680916739"><span class="hs-identifier hs-var">orig1</span></a></span><span>
</span><span id="line-620"></span><span>               </span><span id="local-6989586621680916735"><span class="annot"><span class="annottext">g2 :: Bool
</span><a href="#local-6989586621680916735"><span class="hs-identifier hs-var hs-var">g2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; Bool
</span><a href="GHC.Tc.Types.Origin.html#isGivenOrigin"><span class="hs-identifier hs-var">isGivenOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680916738"><span class="hs-identifier hs-var">orig2</span></a></span><span>
</span><span id="line-621"></span><span>
</span><span id="line-622"></span><span>           </span><span class="annot"><span class="annottext">CtOrigin
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-623"></span><span>
</span><span id="line-624"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#arisesFromGivens"><span class="hs-identifier hs-type">arisesFromGivens</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-625"></span><span id="arisesFromGivens"><span class="annot"><span class="annottext">arisesFromGivens :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#arisesFromGivens"><span class="hs-identifier hs-var hs-var">arisesFromGivens</span></a></span></span><span> </span><span id="local-6989586621680916734"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916734"><span class="hs-identifier hs-var">ct</span></a></span></span><span>
</span><span id="line-626"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916734"><span class="hs-identifier hs-var">ct</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-627"></span><span>      </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtGiven"><span class="hs-identifier hs-type">CtGiven</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-628"></span><span>      </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtWanted"><span class="hs-identifier hs-type">CtWanted</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-629"></span><span>      </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtDerived"><span class="hs-identifier hs-type">CtDerived</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_loc :: CtEvidence -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctev_loc"><span class="hs-identifier hs-var">ctev_loc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916731"><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916731"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">CtLoc -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isGivenLoc"><span class="hs-identifier hs-var">isGivenLoc</span></a></span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916731"><span class="hs-identifier hs-var">loc</span></a></span><span>
</span><span id="line-630"></span><span>
</span><span id="line-631"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isGivenLoc"><span class="hs-identifier hs-type">isGivenLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-632"></span><span id="isGivenLoc"><span class="annot"><span class="annottext">isGivenLoc :: CtLoc -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isGivenLoc"><span class="hs-identifier hs-var hs-var">isGivenLoc</span></a></span></span><span> </span><span id="local-6989586621680916730"><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916730"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; Bool
</span><a href="GHC.Tc.Types.Origin.html#isGivenOrigin"><span class="hs-identifier hs-var">isGivenOrigin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtLoc -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctLocOrigin"><span class="hs-identifier hs-var">ctLocOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916730"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-633"></span><span>
</span><span id="line-634"></span><span class="hs-comment">{- Note [Dropping derived constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In general we discard derived constraints at the end of constraint solving;
see dropDerivedWC.  For example

 * Superclasses: if we have an unsolved [W] (Ord a), we don't want to
   complain about an unsolved [D] (Eq a) as well.

 * If we have [W] a ~ Int, [W] a ~ Bool, improvement will generate
   [D] Int ~ Bool, and we don't want to report that because it's
   incomprehensible. That is why we don't rewrite wanteds with wanteds!

 * We might float out some Wanteds from an implication, leaving behind
   their insoluble Deriveds. For example:

   forall a[2]. [W] alpha[1] ~ Int
                [W] alpha[1] ~ Bool
                [D] Int ~ Bool

   The Derived is insoluble, but we very much want to drop it when floating
   out.

But (tiresomely) we do keep *some* Derived constraints:

 * Type holes are derived constraints, because they have no evidence
   and we want to keep them, so we get the error report

 * We keep most derived equalities arising from functional dependencies
      - Given/Given interactions (subset of FunDepOrigin1):
        The definitely-insoluble ones reflect unreachable code.

        Others not-definitely-insoluble ones like [D] a ~ Int do not
        reflect unreachable code; indeed if fundeps generated proofs, it'd
        be a useful equality.  See #14763.   So we discard them.

      - Given/Wanted interacGiven or Wanted interacting with an
        instance declaration (FunDepOrigin2)

      - Given/Wanted interactions (FunDepOrigin1); see #9612

      - But for Wanted/Wanted interactions we do /not/ want to report an
        error (#13506).  Consider [W] C Int Int, [W] C Int Bool, with
        a fundep on class C.  We don't want to report an insoluble Int~Bool;
        c.f. &quot;wanteds do not rewrite wanteds&quot;.

To distinguish these cases we use the CtOrigin.

NB: we keep *all* derived insolubles under some circumstances:

  * They are looked at by simplifyInfer, to decide whether to
    generalise.  Example: [W] a ~ Int, [W] a ~ Bool
    We get [D] Int ~ Bool, and indeed the constraints are insoluble,
    and we want simplifyInfer to see that, even though we don't
    ultimately want to generate an (inexplicable) error message from it


************************************************************************
*                                                                      *
                    CtEvidence
         The &quot;flavor&quot; of a canonical constraint
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-697"></span><span>
</span><span id="line-698"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isWantedCt"><span class="hs-identifier hs-type">isWantedCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-699"></span><span id="isWantedCt"><span class="annot"><span class="annottext">isWantedCt :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isWantedCt"><span class="hs-identifier hs-var hs-var">isWantedCt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isWanted"><span class="hs-identifier hs-var">isWanted</span></a></span><span> </span><span class="annot"><span class="annottext">(CtEvidence -&gt; Bool) -&gt; (Ct -&gt; CtEvidence) -&gt; Ct -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span>
</span><span id="line-700"></span><span>
</span><span id="line-701"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isGivenCt"><span class="hs-identifier hs-type">isGivenCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-702"></span><span id="isGivenCt"><span class="annot"><span class="annottext">isGivenCt :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isGivenCt"><span class="hs-identifier hs-var hs-var">isGivenCt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isGiven"><span class="hs-identifier hs-var">isGiven</span></a></span><span> </span><span class="annot"><span class="annottext">(CtEvidence -&gt; Bool) -&gt; (Ct -&gt; CtEvidence) -&gt; Ct -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span>
</span><span id="line-703"></span><span>
</span><span id="line-704"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isDerivedCt"><span class="hs-identifier hs-type">isDerivedCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-705"></span><span id="isDerivedCt"><span class="annot"><span class="annottext">isDerivedCt :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isDerivedCt"><span class="hs-identifier hs-var hs-var">isDerivedCt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isDerived"><span class="hs-identifier hs-var">isDerived</span></a></span><span> </span><span class="annot"><span class="annottext">(CtEvidence -&gt; Bool) -&gt; (Ct -&gt; CtEvidence) -&gt; Ct -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span>
</span><span id="line-706"></span><span>
</span><span id="line-707"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCTyEqCan"><span class="hs-identifier hs-type">isCTyEqCan</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-708"></span><span id="isCTyEqCan"><span class="annot"><span class="annottext">isCTyEqCan :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isCTyEqCan"><span class="hs-identifier hs-var hs-var">isCTyEqCan</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CTyEqCan"><span class="hs-identifier hs-type">CTyEqCan</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-709"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCTyEqCan"><span class="hs-identifier hs-var">isCTyEqCan</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><span class="hs-identifier">_</span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-710"></span><span>
</span><span id="line-711"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCDictCan_Maybe"><span class="hs-identifier hs-type">isCDictCan_Maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span>
</span><span id="line-712"></span><span id="isCDictCan_Maybe"><span class="annot"><span class="annottext">isCDictCan_Maybe :: Ct -&gt; Maybe Class
</span><a href="GHC.Tc.Types.Constraint.html#isCDictCan_Maybe"><span class="hs-identifier hs-var hs-var">isCDictCan_Maybe</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CDictCan"><span class="hs-identifier hs-type">CDictCan</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">cc_class :: Ct -&gt; Class
</span><a href="GHC.Tc.Types.Constraint.html#cc_class"><span class="hs-identifier hs-var">cc_class</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916729"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680916729"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Maybe Class
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680916729"><span class="hs-identifier hs-var">cls</span></a></span><span>
</span><span id="line-713"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCDictCan_Maybe"><span class="hs-identifier hs-var">isCDictCan_Maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><span class="hs-identifier">_</span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Class
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-714"></span><span>
</span><span id="line-715"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCFunEqCan_maybe"><span class="hs-identifier hs-type">isCFunEqCan_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-716"></span><span id="isCFunEqCan_maybe"><span class="annot"><span class="annottext">isCFunEqCan_maybe :: Ct -&gt; Maybe (TyCon, [Xi])
</span><a href="GHC.Tc.Types.Constraint.html#isCFunEqCan_maybe"><span class="hs-identifier hs-var hs-var">isCFunEqCan_maybe</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CFunEqCan"><span class="hs-identifier hs-type">CFunEqCan</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_fun :: Ct -&gt; TyCon
</span><a href="GHC.Tc.Types.Constraint.html#cc_fun"><span class="hs-identifier hs-var">cc_fun</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916728"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680916728"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cc_tyargs :: Ct -&gt; [Xi]
</span><a href="GHC.Tc.Types.Constraint.html#cc_tyargs"><span class="hs-identifier hs-var">cc_tyargs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916727"><span class="annot"><span class="annottext">[Xi]
</span><a href="#local-6989586621680916727"><span class="hs-identifier hs-var">xis</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCon, [Xi]) -&gt; Maybe (TyCon, [Xi])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680916728"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Xi]
</span><a href="#local-6989586621680916727"><span class="hs-identifier hs-var">xis</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-717"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCFunEqCan_maybe"><span class="hs-identifier hs-var">isCFunEqCan_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (TyCon, [Xi])
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-718"></span><span>
</span><span id="line-719"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCFunEqCan"><span class="hs-identifier hs-type">isCFunEqCan</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-720"></span><span id="isCFunEqCan"><span class="annot"><span class="annottext">isCFunEqCan :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isCFunEqCan"><span class="hs-identifier hs-var hs-var">isCFunEqCan</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CFunEqCan"><span class="hs-identifier hs-type">CFunEqCan</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-721"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCFunEqCan"><span class="hs-identifier hs-var">isCFunEqCan</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-722"></span><span>
</span><span id="line-723"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCNonCanonical"><span class="hs-identifier hs-type">isCNonCanonical</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-724"></span><span id="isCNonCanonical"><span class="annot"><span class="annottext">isCNonCanonical :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isCNonCanonical"><span class="hs-identifier hs-var hs-var">isCNonCanonical</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CNonCanonical"><span class="hs-identifier hs-type">CNonCanonical</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-725"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isCNonCanonical"><span class="hs-identifier hs-var">isCNonCanonical</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-726"></span><span>
</span><span id="line-727"></span><span class="hs-comment">{- Note [Custom type errors in constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When GHC reports a type-error about an unsolved-constraint, we check
to see if the constraint contains any custom-type errors, and if so
we report them.  Here are some examples of constraints containing type
errors:

TypeError msg           -- The actual constraint is a type error

TypError msg ~ Int      -- Some type was supposed to be Int, but ended up
                        -- being a type error instead

Eq (TypeError msg)      -- A class constraint is stuck due to a type error

F (TypeError msg) ~ a   -- A type function failed to evaluate due to a type err

It is also possible to have constraints where the type error is nested deeper,
for example see #11990, and also:

Eq (F (TypeError msg))  -- Here the type error is nested under a type-function
                        -- call, which failed to evaluate because of it,
                        -- and so the `Eq` constraint was unsolved.
                        -- This may happen when one function calls another
                        -- and the called function produced a custom type error.
-}</span><span>
</span><span id="line-753"></span><span>
</span><span id="line-754"></span><span class="hs-comment">-- | A constraint is considered to be a custom type error, if it contains</span><span>
</span><span id="line-755"></span><span class="hs-comment">-- custom type errors anywhere in it.</span><span>
</span><span id="line-756"></span><span class="hs-comment">-- See Note [Custom type errors in constraints]</span><span>
</span><span id="line-757"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#getUserTypeErrorMsg"><span class="hs-identifier hs-type">getUserTypeErrorMsg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-758"></span><span id="getUserTypeErrorMsg"><span class="annot"><span class="annottext">getUserTypeErrorMsg :: Ct -&gt; Maybe Xi
</span><a href="GHC.Tc.Types.Constraint.html#getUserTypeErrorMsg"><span class="hs-identifier hs-var hs-var">getUserTypeErrorMsg</span></a></span></span><span> </span><span id="local-6989586621680916726"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916726"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Xi -&gt; Maybe Xi
</span><a href="#local-6989586621680916725"><span class="hs-identifier hs-var">findUserTypeError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#ctPred"><span class="hs-identifier hs-var">ctPred</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916726"><span class="hs-identifier hs-var">ct</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-759"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-760"></span><span>  </span><span id="local-6989586621680916725"><span class="annot"><span class="annottext">findUserTypeError :: Xi -&gt; Maybe Xi
</span><a href="#local-6989586621680916725"><span class="hs-identifier hs-var hs-var">findUserTypeError</span></a></span></span><span> </span><span id="local-6989586621680916721"><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916721"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Maybe Xi] -&gt; Maybe Xi
forall (t :: * -&gt; *) (m :: * -&gt; *) a.
(Foldable t, MonadPlus m) =&gt;
t (m a) -&gt; m a
</span><a href="../../base/src/Data.Foldable.html#msum"><span class="hs-identifier hs-var">msum</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">Xi -&gt; Maybe Xi
</span><a href="GHC.Core.Type.html#userTypeError_maybe"><span class="hs-identifier hs-var">userTypeError_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916721"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-761"></span><span>                             </span><span class="annot"><span class="annottext">Maybe Xi -&gt; [Maybe Xi] -&gt; [Maybe Xi]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">(Xi -&gt; Maybe Xi) -&gt; [Xi] -&gt; [Maybe Xi]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Xi -&gt; Maybe Xi
</span><a href="#local-6989586621680916725"><span class="hs-identifier hs-var">findUserTypeError</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Xi -&gt; [Xi]
</span><a href="#local-6989586621680916719"><span class="hs-identifier hs-var">subTys</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916721"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-762"></span><span>                             </span><span class="hs-special">)</span><span>
</span><span id="line-763"></span><span>
</span><span id="line-764"></span><span>  </span><span id="local-6989586621680916719"><span class="annot"><span class="annottext">subTys :: Xi -&gt; [Xi]
</span><a href="#local-6989586621680916719"><span class="hs-identifier hs-var hs-var">subTys</span></a></span></span><span> </span><span id="local-6989586621680916717"><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916717"><span class="hs-identifier hs-var">t</span></a></span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Xi -&gt; (Xi, [Xi])
</span><a href="GHC.Core.Type.html#splitAppTys"><span class="hs-identifier hs-var">splitAppTys</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916717"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-765"></span><span>                          </span><span class="hs-special">(</span><span id="local-6989586621680916715"><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916715"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-766"></span><span>                            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Xi -&gt; Maybe (TyCon, [Xi])
Xi -&gt; Maybe (TyCon, [Xi])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916715"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-767"></span><span>                              </span><span class="annot"><span class="annottext">Maybe (TyCon, [Xi])
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-768"></span><span>                              </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621680916713"><span class="annot"><span class="annottext">[Xi]
</span><a href="#local-6989586621680916713"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Xi]
</span><a href="#local-6989586621680916713"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-769"></span><span>                          </span><span class="hs-special">(</span><span id="local-6989586621680916712"><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916712"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680916711"><span class="annot"><span class="annottext">[Xi]
</span><a href="#local-6989586621680916711"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916712"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Xi -&gt; [Xi] -&gt; [Xi]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[Xi]
</span><a href="#local-6989586621680916711"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-770"></span><span>
</span><span id="line-771"></span><span>
</span><span id="line-772"></span><span>
</span><span id="line-773"></span><span>
</span><span id="line-774"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isUserTypeErrorCt"><span class="hs-identifier hs-type">isUserTypeErrorCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-775"></span><span id="isUserTypeErrorCt"><span class="annot"><span class="annottext">isUserTypeErrorCt :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isUserTypeErrorCt"><span class="hs-identifier hs-var hs-var">isUserTypeErrorCt</span></a></span></span><span> </span><span id="local-6989586621680916710"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916710"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Maybe Xi
</span><a href="GHC.Tc.Types.Constraint.html#getUserTypeErrorMsg"><span class="hs-identifier hs-var">getUserTypeErrorMsg</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916710"><span class="hs-identifier hs-var">ct</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-776"></span><span>                         </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-777"></span><span>                         </span><span class="annot"><span class="annottext">Maybe Xi
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-778"></span><span>
</span><span id="line-779"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isPendingScDict"><span class="hs-identifier hs-type">isPendingScDict</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span>
</span><span id="line-780"></span><span class="hs-comment">-- Says whether this is a CDictCan with cc_pend_sc is True,</span><span>
</span><span id="line-781"></span><span class="hs-comment">-- AND if so flips the flag</span><span>
</span><span id="line-782"></span><span id="isPendingScDict"><span class="annot"><span class="annottext">isPendingScDict :: Ct -&gt; Maybe Ct
</span><a href="GHC.Tc.Types.Constraint.html#isPendingScDict"><span class="hs-identifier hs-var hs-var">isPendingScDict</span></a></span></span><span> </span><span id="local-6989586621680916709"><span class="annot"><span class="annottext">ct :: Ct
</span><a href="#local-6989586621680916709"><span class="hs-identifier hs-var">ct</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CDictCan"><span class="hs-identifier hs-type">CDictCan</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_pend_sc :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#cc_pend_sc"><span class="hs-identifier hs-var">cc_pend_sc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-783"></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Maybe Ct
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916709"><span class="hs-identifier hs-var">ct</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_pend_sc :: Bool
</span><a href="GHC.Tc.Types.Constraint.html#cc_pend_sc"><span class="hs-identifier hs-var">cc_pend_sc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-784"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isPendingScDict"><span class="hs-identifier hs-var">isPendingScDict</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Ct
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-785"></span><span>
</span><span id="line-786"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isPendingScInst"><span class="hs-identifier hs-type">isPendingScInst</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#QCInst"><span class="hs-identifier hs-type">QCInst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#QCInst"><span class="hs-identifier hs-type">QCInst</span></a></span><span>
</span><span id="line-787"></span><span class="hs-comment">-- Same as isPendingScDict, but for QCInsts</span><span>
</span><span id="line-788"></span><span id="isPendingScInst"><span class="annot"><span class="annottext">isPendingScInst :: QCInst -&gt; Maybe QCInst
</span><a href="GHC.Tc.Types.Constraint.html#isPendingScInst"><span class="hs-identifier hs-var hs-var">isPendingScInst</span></a></span></span><span> </span><span id="local-6989586621680916708"><span class="annot"><span class="annottext">qci :: QCInst
</span><a href="#local-6989586621680916708"><span class="hs-identifier hs-var">qci</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#QCI"><span class="hs-identifier hs-type">QCI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">qci_pend_sc :: QCInst -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#qci_pend_sc"><span class="hs-identifier hs-var">qci_pend_sc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-789"></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">QCInst -&gt; Maybe QCInst
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">QCInst
</span><a href="#local-6989586621680916708"><span class="hs-identifier hs-var">qci</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">qci_pend_sc :: Bool
</span><a href="GHC.Tc.Types.Constraint.html#qci_pend_sc"><span class="hs-identifier hs-var">qci_pend_sc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-790"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isPendingScInst"><span class="hs-identifier hs-var">isPendingScInst</span></a></span><span> </span><span class="annot"><span class="annottext">QCInst
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe QCInst
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-791"></span><span>
</span><span id="line-792"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#setPendingScDict"><span class="hs-identifier hs-type">setPendingScDict</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span>
</span><span id="line-793"></span><span class="hs-comment">-- Set the cc_pend_sc flag to True</span><span>
</span><span id="line-794"></span><span id="setPendingScDict"><span class="annot"><span class="annottext">setPendingScDict :: Ct -&gt; Ct
</span><a href="GHC.Tc.Types.Constraint.html#setPendingScDict"><span class="hs-identifier hs-var hs-var">setPendingScDict</span></a></span></span><span> </span><span id="local-6989586621680916707"><span class="annot"><span class="annottext">ct :: Ct
</span><a href="#local-6989586621680916707"><span class="hs-identifier hs-var">ct</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CDictCan"><span class="hs-identifier hs-type">CDictCan</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_pend_sc :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#cc_pend_sc"><span class="hs-identifier hs-var">cc_pend_sc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-795"></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916707"><span class="hs-identifier hs-var">ct</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_pend_sc :: Bool
</span><a href="GHC.Tc.Types.Constraint.html#cc_pend_sc"><span class="hs-identifier hs-var">cc_pend_sc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-796"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#setPendingScDict"><span class="hs-identifier hs-var">setPendingScDict</span></a></span><span> </span><span id="local-6989586621680916706"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916706"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916706"><span class="hs-identifier hs-var">ct</span></a></span><span>
</span><span id="line-797"></span><span>
</span><span id="line-798"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#superClassesMightHelp"><span class="hs-identifier hs-type">superClassesMightHelp</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-799"></span><span class="hs-comment">-- ^ True if taking superclasses of givens, or of wanteds (to perhaps</span><span>
</span><span id="line-800"></span><span class="hs-comment">-- expose more equalities or functional dependencies) might help to</span><span>
</span><span id="line-801"></span><span class="hs-comment">-- solve this constraint.  See Note [When superclasses help]</span><span>
</span><span id="line-802"></span><span id="superClassesMightHelp"><span class="annot"><span class="annottext">superClassesMightHelp :: WantedConstraints -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#superClassesMightHelp"><span class="hs-identifier hs-var hs-var">superClassesMightHelp</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916705"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916705"><span class="hs-identifier hs-var">simples</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_impl :: WantedConstraints -&gt; Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916704"><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916704"><span class="hs-identifier hs-var">implics</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-803"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Ct -&gt; Bool) -&gt; Cts -&gt; Bool
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier hs-var">anyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Bool
</span><a href="#local-6989586621680916702"><span class="hs-identifier hs-var">might_help_ct</span></a></span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916705"><span class="hs-identifier hs-var">simples</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">(Implication -&gt; Bool) -&gt; Bag Implication -&gt; Bool
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier hs-var">anyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Implication -&gt; Bool
</span><a href="#local-6989586621680916701"><span class="hs-identifier hs-var">might_help_implic</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916704"><span class="hs-identifier hs-var">implics</span></a></span><span>
</span><span id="line-804"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-805"></span><span>    </span><span id="local-6989586621680916701"><span class="annot"><span class="annottext">might_help_implic :: Implication -&gt; Bool
</span><a href="#local-6989586621680916701"><span class="hs-identifier hs-var hs-var">might_help_implic</span></a></span></span><span> </span><span id="local-6989586621680916700"><span class="annot"><span class="annottext">Implication
</span><a href="#local-6989586621680916700"><span class="hs-identifier hs-var">ic</span></a></span></span><span>
</span><span id="line-806"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#IC_Unsolved"><span class="hs-identifier hs-var">IC_Unsolved</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Implication -&gt; ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#ic_status"><span class="hs-identifier hs-var hs-var">ic_status</span></a></span><span> </span><span class="annot"><span class="annottext">Implication
</span><a href="#local-6989586621680916700"><span class="hs-identifier hs-var">ic</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#superClassesMightHelp"><span class="hs-identifier hs-var">superClassesMightHelp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Implication -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#ic_wanted"><span class="hs-identifier hs-var hs-var">ic_wanted</span></a></span><span> </span><span class="annot"><span class="annottext">Implication
</span><a href="#local-6989586621680916700"><span class="hs-identifier hs-var">ic</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-807"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-808"></span><span>
</span><span id="line-809"></span><span>    </span><span id="local-6989586621680916702"><span class="annot"><span class="annottext">might_help_ct :: Ct -&gt; Bool
</span><a href="#local-6989586621680916702"><span class="hs-identifier hs-var hs-var">might_help_ct</span></a></span></span><span> </span><span id="local-6989586621680916697"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916697"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isWantedCt"><span class="hs-identifier hs-var">isWantedCt</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916697"><span class="hs-identifier hs-var">ct</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct -&gt; Bool
</span><a href="#local-6989586621680916696"><span class="hs-identifier hs-var">is_ip</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916697"><span class="hs-identifier hs-var">ct</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-810"></span><span>
</span><span id="line-811"></span><span>    </span><span id="local-6989586621680916696"><span class="annot"><span class="annottext">is_ip :: Ct -&gt; Bool
</span><a href="#local-6989586621680916696"><span class="hs-identifier hs-var hs-var">is_ip</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CDictCan"><span class="hs-identifier hs-type">CDictCan</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_class :: Ct -&gt; Class
</span><a href="GHC.Tc.Types.Constraint.html#cc_class"><span class="hs-identifier hs-var">cc_class</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916695"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680916695"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isIPClass"><span class="hs-identifier hs-var">isIPClass</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680916695"><span class="hs-identifier hs-var">cls</span></a></span><span>
</span><span id="line-812"></span><span>    </span><span class="annot"><a href="#local-6989586621680916696"><span class="hs-identifier hs-var">is_ip</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><span class="hs-identifier">_</span></span><span>                             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-813"></span><span>
</span><span id="line-814"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#getPendingWantedScs"><span class="hs-identifier hs-type">getPendingWantedScs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-815"></span><span id="getPendingWantedScs"><span class="annot"><span class="annottext">getPendingWantedScs :: Cts -&gt; ([Ct], Cts)
</span><a href="GHC.Tc.Types.Constraint.html#getPendingWantedScs"><span class="hs-identifier hs-var hs-var">getPendingWantedScs</span></a></span></span><span> </span><span id="local-6989586621680916693"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916693"><span class="hs-identifier hs-var">simples</span></a></span></span><span>
</span><span id="line-816"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Ct] -&gt; Ct -&gt; ([Ct], Ct)) -&gt; [Ct] -&gt; Cts -&gt; ([Ct], Cts)
forall acc x y.
(acc -&gt; x -&gt; (acc, y)) -&gt; acc -&gt; Bag x -&gt; (acc, Bag y)
</span><a href="GHC.Data.Bag.html#mapAccumBagL"><span class="hs-identifier hs-var">mapAccumBagL</span></a></span><span> </span><span class="annot"><span class="annottext">[Ct] -&gt; Ct -&gt; ([Ct], Ct)
</span><a href="#local-6989586621680916691"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916693"><span class="hs-identifier hs-var">simples</span></a></span><span>
</span><span id="line-817"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-818"></span><span>    </span><span id="local-6989586621680916691"><span class="annot"><span class="annottext">get :: [Ct] -&gt; Ct -&gt; ([Ct], Ct)
</span><a href="#local-6989586621680916691"><span class="hs-identifier hs-var hs-var">get</span></a></span></span><span> </span><span id="local-6989586621680916690"><span class="annot"><span class="annottext">[Ct]
</span><a href="#local-6989586621680916690"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span id="local-6989586621680916689"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916689"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680916688"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916688"><span class="hs-identifier hs-var">ct'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Maybe Ct
</span><a href="GHC.Tc.Types.Constraint.html#isPendingScDict"><span class="hs-identifier hs-var">isPendingScDict</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916689"><span class="hs-identifier hs-var">ct</span></a></span><span>
</span><span id="line-819"></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916688"><span class="hs-identifier hs-var">ct'</span></a></span><span class="annot"><span class="annottext">Ct -&gt; [Ct] -&gt; [Ct]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Ct]
</span><a href="#local-6989586621680916690"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916688"><span class="hs-identifier hs-var">ct'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-820"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-821"></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Ct]
</span><a href="#local-6989586621680916690"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">,</span><span>     </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916689"><span class="hs-identifier hs-var">ct</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-822"></span><span>
</span><span id="line-823"></span><span class="hs-comment">{- Note [When superclasses help]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
First read Note [The superclass story] in GHC.Tc.Solver.Canonical.

We expand superclasses and iterate only if there is at unsolved wanted
for which expansion of superclasses (e.g. from given constraints)
might actually help. The function superClassesMightHelp tells if
doing this superclass expansion might help solve this constraint.
Note that

  * We look inside implications; maybe it'll help to expand the Givens
    at level 2 to help solve an unsolved Wanted buried inside an
    implication.  E.g.
        forall a. Ord a =&gt; forall b. [W] Eq a

  * Superclasses help only for Wanted constraints.  Derived constraints
    are not really &quot;unsolved&quot; and we certainly don't want them to
    trigger superclass expansion. This was a good part of the loop
    in  #11523

  * Even for Wanted constraints, we say &quot;no&quot; for implicit parameters.
    we have [W] ?x::ty, expanding superclasses won't help:
      - Superclasses can't be implicit parameters
      - If we have a [G] ?x:ty2, then we'll have another unsolved
        [D] ty ~ ty2 (from the functional dependency)
        which will trigger superclass expansion.

    It's a bit of a special case, but it's easy to do.  The runtime cost
    is low because the unsolved set is usually empty anyway (errors
    aside), and the first non-implicit-parameter will terminate the search.

    The special case is worth it (#11480, comment:2) because it
    applies to CallStack constraints, which aren't type errors. If we have
       f :: (C a) =&gt; blah
       f x = ...undefined...
    we'll get a CallStack constraint.  If that's the only unsolved
    constraint it'll eventually be solved by defaulting.  So we don't
    want to emit warnings about hitting the simplifier's iteration
    limit.  A CallStack constraint really isn't an unsolved
    constraint; it can always be solved by defaulting.
-}</span><span>
</span><span id="line-864"></span><span>
</span><span id="line-865"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#singleCt"><span class="hs-identifier hs-type">singleCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span>
</span><span id="line-866"></span><span id="singleCt"><span class="annot"><span class="annottext">singleCt :: Ct -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#singleCt"><span class="hs-identifier hs-var hs-var">singleCt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Cts
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span>
</span><span id="line-867"></span><span>
</span><span id="line-868"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#andCts"><span class="hs-identifier hs-type">andCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span>
</span><span id="line-869"></span><span id="andCts"><span class="annot"><span class="annottext">andCts :: Cts -&gt; Cts -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#andCts"><span class="hs-identifier hs-var hs-var">andCts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Cts -&gt; Cts -&gt; Cts
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span>
</span><span id="line-870"></span><span>
</span><span id="line-871"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#listToCts"><span class="hs-identifier hs-type">listToCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span>
</span><span id="line-872"></span><span id="listToCts"><span class="annot"><span class="annottext">listToCts :: [Ct] -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#listToCts"><span class="hs-identifier hs-var hs-var">listToCts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Ct] -&gt; Cts
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span>
</span><span id="line-873"></span><span>
</span><span id="line-874"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctsElts"><span class="hs-identifier hs-type">ctsElts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-875"></span><span id="ctsElts"><span class="annot"><span class="annottext">ctsElts :: Cts -&gt; [Ct]
</span><a href="GHC.Tc.Types.Constraint.html#ctsElts"><span class="hs-identifier hs-var hs-var">ctsElts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Cts -&gt; [Ct]
forall a. Bag a -&gt; [a]
</span><a href="GHC.Data.Bag.html#bagToList"><span class="hs-identifier hs-var">bagToList</span></a></span><span>
</span><span id="line-876"></span><span>
</span><span id="line-877"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#consCts"><span class="hs-identifier hs-type">consCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span>
</span><span id="line-878"></span><span id="consCts"><span class="annot"><span class="annottext">consCts :: Ct -&gt; Cts -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#consCts"><span class="hs-identifier hs-var hs-var">consCts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Cts -&gt; Cts
forall a. a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#consBag"><span class="hs-identifier hs-var">consBag</span></a></span><span>
</span><span id="line-879"></span><span>
</span><span id="line-880"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#snocCts"><span class="hs-identifier hs-type">snocCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span>
</span><span id="line-881"></span><span id="snocCts"><span class="annot"><span class="annottext">snocCts :: Cts -&gt; Ct -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#snocCts"><span class="hs-identifier hs-var hs-var">snocCts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Cts -&gt; Ct -&gt; Cts
forall a. Bag a -&gt; a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#snocBag"><span class="hs-identifier hs-var">snocBag</span></a></span><span>
</span><span id="line-882"></span><span>
</span><span id="line-883"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#extendCtsList"><span class="hs-identifier hs-type">extendCtsList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span>
</span><span id="line-884"></span><span id="extendCtsList"><span class="annot"><span class="annottext">extendCtsList :: Cts -&gt; [Ct] -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#extendCtsList"><span class="hs-identifier hs-var hs-var">extendCtsList</span></a></span></span><span> </span><span id="local-6989586621680916681"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916681"><span class="hs-identifier hs-var">cts</span></a></span></span><span> </span><span id="local-6989586621680916680"><span class="annot"><span class="annottext">[Ct]
</span><a href="#local-6989586621680916680"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[Ct] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Ct]
</span><a href="#local-6989586621680916680"><span class="hs-identifier hs-var">xs</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916681"><span class="hs-identifier hs-var">cts</span></a></span><span>
</span><span id="line-885"></span><span>                     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916681"><span class="hs-identifier hs-var">cts</span></a></span><span> </span><span class="annot"><span class="annottext">Cts -&gt; Cts -&gt; Cts
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">[Ct] -&gt; Cts
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="annot"><span class="annottext">[Ct]
</span><a href="#local-6989586621680916680"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-886"></span><span>
</span><span id="line-887"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#andManyCts"><span class="hs-identifier hs-type">andManyCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span>
</span><span id="line-888"></span><span id="andManyCts"><span class="annot"><span class="annottext">andManyCts :: [Cts] -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#andManyCts"><span class="hs-identifier hs-var hs-var">andManyCts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Cts] -&gt; Cts
forall a. [Bag a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionManyBags"><span class="hs-identifier hs-var">unionManyBags</span></a></span><span>
</span><span id="line-889"></span><span>
</span><span id="line-890"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#emptyCts"><span class="hs-identifier hs-type">emptyCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span>
</span><span id="line-891"></span><span id="emptyCts"><span class="annot"><span class="annottext">emptyCts :: Cts
</span><a href="GHC.Tc.Types.Constraint.html#emptyCts"><span class="hs-identifier hs-var hs-var">emptyCts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Cts
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span>
</span><span id="line-892"></span><span>
</span><span id="line-893"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isEmptyCts"><span class="hs-identifier hs-type">isEmptyCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-894"></span><span id="isEmptyCts"><span class="annot"><span class="annottext">isEmptyCts :: Cts -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isEmptyCts"><span class="hs-identifier hs-var hs-var">isEmptyCts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Cts -&gt; Bool
forall a. Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#isEmptyBag"><span class="hs-identifier hs-var">isEmptyBag</span></a></span><span>
</span><span id="line-895"></span><span>
</span><span id="line-896"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#pprCts"><span class="hs-identifier hs-type">pprCts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-897"></span><span id="pprCts"><span class="annot"><span class="annottext">pprCts :: Cts -&gt; SDoc
</span><a href="GHC.Tc.Types.Constraint.html#pprCts"><span class="hs-identifier hs-var hs-var">pprCts</span></a></span></span><span> </span><span id="local-6989586621680916675"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916675"><span class="hs-identifier hs-var">cts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Ct -&gt; SDoc) -&gt; [Ct] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Cts -&gt; [Ct]
forall a. Bag a -&gt; [a]
</span><a href="GHC.Data.Bag.html#bagToList"><span class="hs-identifier hs-var">bagToList</span></a></span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916675"><span class="hs-identifier hs-var">cts</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-898"></span><span>
</span><span id="line-899"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                Wanted constraints
     These are forced to be in GHC.Tc.Types because
           TcLclEnv mentions WantedConstraints
           WantedConstraint mentions CtLoc
           CtLoc mentions ErrCtxt
           ErrCtxt mentions TcM
*                                                                      *
v%************************************************************************
-}</span><span>
</span><span id="line-911"></span><span>
</span><span id="line-912"></span><span class="hs-keyword">data</span><span> </span><span id="WantedConstraints"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-var">WantedConstraints</span></a></span></span><span>
</span><span id="line-913"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="WC"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-var">WC</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="wc_simple"><span class="annot"><span class="annottext">WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var hs-var">wc_simple</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Cts"><span class="hs-identifier hs-type">Cts</span></a></span><span>              </span><span class="hs-comment">-- Unsolved constraints, all wanted</span><span>
</span><span id="line-914"></span><span>       </span><span class="hs-special">,</span><span> </span><span id="wc_impl"><span class="annot"><span class="annottext">WantedConstraints -&gt; Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var hs-var">wc_impl</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Implication"><span class="hs-identifier hs-type">Implication</span></a></span><span>
</span><span id="line-915"></span><span>       </span><span class="hs-special">,</span><span> </span><span id="wc_holes"><span class="annot"><span class="annottext">WantedConstraints -&gt; Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var hs-var">wc_holes</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Hole"><span class="hs-identifier hs-type">Hole</span></a></span><span>
</span><span id="line-916"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-917"></span><span>
</span><span id="line-918"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#emptyWC"><span class="hs-identifier hs-type">emptyWC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span>
</span><span id="line-919"></span><span id="emptyWC"><span class="annot"><span class="annottext">emptyWC :: WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#emptyWC"><span class="hs-identifier hs-var hs-var">emptyWC</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WC :: Cts -&gt; Bag Implication -&gt; Bag Hole -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Cts
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span>
</span><span id="line-920"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_impl :: Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag Implication
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span>
</span><span id="line-921"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_holes :: Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var">wc_holes</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag Hole
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-922"></span><span>
</span><span id="line-923"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkSimpleWC"><span class="hs-identifier hs-type">mkSimpleWC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span>
</span><span id="line-924"></span><span id="mkSimpleWC"><span class="annot"><span class="annottext">mkSimpleWC :: [CtEvidence] -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#mkSimpleWC"><span class="hs-identifier hs-var hs-var">mkSimpleWC</span></a></span></span><span> </span><span id="local-6989586621680916673"><span class="annot"><span class="annottext">[CtEvidence]
</span><a href="#local-6989586621680916673"><span class="hs-identifier hs-var">cts</span></a></span></span><span>
</span><span id="line-925"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#emptyWC"><span class="hs-identifier hs-var">emptyWC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Ct] -&gt; Cts
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(CtEvidence -&gt; Ct) -&gt; [CtEvidence] -&gt; [Ct]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; Ct
</span><a href="GHC.Tc.Types.Constraint.html#mkNonCanonical"><span class="hs-identifier hs-var">mkNonCanonical</span></a></span><span> </span><span class="annot"><span class="annottext">[CtEvidence]
</span><a href="#local-6989586621680916673"><span class="hs-identifier hs-var">cts</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-926"></span><span>
</span><span id="line-927"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkImplicWC"><span class="hs-identifier hs-type">mkImplicWC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Implication"><span class="hs-identifier hs-type">Implication</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span>
</span><span id="line-928"></span><span id="mkImplicWC"><span class="annot"><span class="annottext">mkImplicWC :: Bag Implication -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#mkImplicWC"><span class="hs-identifier hs-var hs-var">mkImplicWC</span></a></span></span><span> </span><span id="local-6989586621680916672"><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916672"><span class="hs-identifier hs-var">implic</span></a></span></span><span>
</span><span id="line-929"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#emptyWC"><span class="hs-identifier hs-var">emptyWC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_impl :: Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916672"><span class="hs-identifier hs-var">implic</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-930"></span><span>
</span><span id="line-931"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isEmptyWC"><span class="hs-identifier hs-type">isEmptyWC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-932"></span><span id="isEmptyWC"><span class="annot"><span class="annottext">isEmptyWC :: WantedConstraints -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isEmptyWC"><span class="hs-identifier hs-var hs-var">isEmptyWC</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916671"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916671"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_impl :: WantedConstraints -&gt; Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916670"><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916670"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_holes :: WantedConstraints -&gt; Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var">wc_holes</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916669"><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916669"><span class="hs-identifier hs-var">holes</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-933"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Cts -&gt; Bool
forall a. Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#isEmptyBag"><span class="hs-identifier hs-var">isEmptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916671"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bag Implication -&gt; Bool
forall a. Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#isEmptyBag"><span class="hs-identifier hs-var">isEmptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916670"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bag Hole -&gt; Bool
forall a. Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#isEmptyBag"><span class="hs-identifier hs-var">isEmptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916669"><span class="hs-identifier hs-var">holes</span></a></span><span>
</span><span id="line-934"></span><span>
</span><span id="line-935"></span><span class="hs-comment">-- | Checks whether a the given wanted constraints are solved, i.e.</span><span>
</span><span id="line-936"></span><span class="hs-comment">-- that there are no simple constraints left and all the implications</span><span>
</span><span id="line-937"></span><span class="hs-comment">-- are solved.</span><span>
</span><span id="line-938"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isSolvedWC"><span class="hs-identifier hs-type">isSolvedWC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-939"></span><span id="isSolvedWC"><span class="annot"><span class="annottext">isSolvedWC :: WantedConstraints -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isSolvedWC"><span class="hs-identifier hs-var hs-var">isSolvedWC</span></a></span></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">wc_simple :: WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916668"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916668"><span class="hs-identifier hs-var">wc_simple</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_impl :: WantedConstraints -&gt; Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916667"><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916667"><span class="hs-identifier hs-var">wc_impl</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_holes :: WantedConstraints -&gt; Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var">wc_holes</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916666"><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916666"><span class="hs-identifier hs-var">holes</span></a></span></span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-940"></span><span>  </span><span class="annot"><span class="annottext">Cts -&gt; Bool
forall a. Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#isEmptyBag"><span class="hs-identifier hs-var">isEmptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916668"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(Implication -&gt; Bool) -&gt; Bag Implication -&gt; Bool
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#allBag"><span class="hs-identifier hs-var">allBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImplicStatus -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isSolvedStatus"><span class="hs-identifier hs-var">isSolvedStatus</span></a></span><span> </span><span class="annot"><span class="annottext">(ImplicStatus -&gt; Bool)
-&gt; (Implication -&gt; ImplicStatus) -&gt; Implication -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Implication -&gt; ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#ic_status"><span class="hs-identifier hs-var hs-var">ic_status</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916667"><span class="hs-identifier hs-var">wc_impl</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bag Hole -&gt; Bool
forall a. Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#isEmptyBag"><span class="hs-identifier hs-var">isEmptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916666"><span class="hs-identifier hs-var">holes</span></a></span><span>
</span><span id="line-941"></span><span>
</span><span id="line-942"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#andWC"><span class="hs-identifier hs-type">andWC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span>
</span><span id="line-943"></span><span id="andWC"><span class="annot"><span class="annottext">andWC :: WantedConstraints -&gt; WantedConstraints -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#andWC"><span class="hs-identifier hs-var hs-var">andWC</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916664"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916664"><span class="hs-identifier hs-var">f1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_impl :: WantedConstraints -&gt; Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916663"><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916663"><span class="hs-identifier hs-var">i1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_holes :: WantedConstraints -&gt; Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var">wc_holes</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916662"><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916662"><span class="hs-identifier hs-var">h1</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-944"></span><span>      </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916661"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916661"><span class="hs-identifier hs-var">f2</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_impl :: WantedConstraints -&gt; Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916660"><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916660"><span class="hs-identifier hs-var">i2</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_holes :: WantedConstraints -&gt; Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var">wc_holes</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916659"><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916659"><span class="hs-identifier hs-var">h2</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-945"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WC :: Cts -&gt; Bag Implication -&gt; Bag Hole -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916664"><span class="hs-identifier hs-var">f1</span></a></span><span> </span><span class="annot"><span class="annottext">Cts -&gt; Cts -&gt; Cts
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916661"><span class="hs-identifier hs-var">f2</span></a></span><span>
</span><span id="line-946"></span><span>       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_impl :: Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916663"><span class="hs-identifier hs-var">i1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Implication -&gt; Bag Implication -&gt; Bag Implication
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916660"><span class="hs-identifier hs-var">i2</span></a></span><span>
</span><span id="line-947"></span><span>       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_holes :: Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var">wc_holes</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916662"><span class="hs-identifier hs-var">h1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Hole -&gt; Bag Hole -&gt; Bag Hole
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916659"><span class="hs-identifier hs-var">h2</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-948"></span><span>
</span><span id="line-949"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#unionsWC"><span class="hs-identifier hs-type">unionsWC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span>
</span><span id="line-950"></span><span id="unionsWC"><span class="annot"><span class="annottext">unionsWC :: [WantedConstraints] -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#unionsWC"><span class="hs-identifier hs-var hs-var">unionsWC</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(WantedConstraints -&gt; WantedConstraints -&gt; WantedConstraints)
-&gt; WantedConstraints -&gt; [WantedConstraints] -&gt; WantedConstraints
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; WantedConstraints -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#andWC"><span class="hs-identifier hs-var">andWC</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#emptyWC"><span class="hs-identifier hs-var">emptyWC</span></a></span><span>
</span><span id="line-951"></span><span>
</span><span id="line-952"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#addSimples"><span class="hs-identifier hs-type">addSimples</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span>
</span><span id="line-953"></span><span id="addSimples"><span class="annot"><span class="annottext">addSimples :: WantedConstraints -&gt; Cts -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#addSimples"><span class="hs-identifier hs-var hs-var">addSimples</span></a></span></span><span> </span><span id="local-6989586621680916658"><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916658"><span class="hs-identifier hs-var">wc</span></a></span></span><span> </span><span id="local-6989586621680916657"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916657"><span class="hs-identifier hs-var">cts</span></a></span></span><span>
</span><span id="line-954"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916658"><span class="hs-identifier hs-var">wc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var hs-var">wc_simple</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916658"><span class="hs-identifier hs-var">wc</span></a></span><span> </span><span class="annot"><span class="annottext">Cts -&gt; Cts -&gt; Cts
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916657"><span class="hs-identifier hs-var">cts</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-955"></span><span>    </span><span class="hs-comment">-- Consider: Put the new constraints at the front, so they get solved first</span><span>
</span><span id="line-956"></span><span>
</span><span id="line-957"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#addImplics"><span class="hs-identifier hs-type">addImplics</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Implication"><span class="hs-identifier hs-type">Implication</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span>
</span><span id="line-958"></span><span id="addImplics"><span class="annot"><span class="annottext">addImplics :: WantedConstraints -&gt; Bag Implication -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#addImplics"><span class="hs-identifier hs-var hs-var">addImplics</span></a></span></span><span> </span><span id="local-6989586621680916656"><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916656"><span class="hs-identifier hs-var">wc</span></a></span></span><span> </span><span id="local-6989586621680916655"><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916655"><span class="hs-identifier hs-var">implic</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916656"><span class="hs-identifier hs-var">wc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_impl :: Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var hs-var">wc_impl</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916656"><span class="hs-identifier hs-var">wc</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Implication -&gt; Bag Implication -&gt; Bag Implication
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916655"><span class="hs-identifier hs-var">implic</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-959"></span><span>
</span><span id="line-960"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#addInsols"><span class="hs-identifier hs-type">addInsols</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span>
</span><span id="line-961"></span><span id="addInsols"><span class="annot"><span class="annottext">addInsols :: WantedConstraints -&gt; Cts -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#addInsols"><span class="hs-identifier hs-var hs-var">addInsols</span></a></span></span><span> </span><span id="local-6989586621680916654"><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916654"><span class="hs-identifier hs-var">wc</span></a></span></span><span> </span><span id="local-6989586621680916653"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916653"><span class="hs-identifier hs-var">cts</span></a></span></span><span>
</span><span id="line-962"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916654"><span class="hs-identifier hs-var">wc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var hs-var">wc_simple</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916654"><span class="hs-identifier hs-var">wc</span></a></span><span> </span><span class="annot"><span class="annottext">Cts -&gt; Cts -&gt; Cts
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916653"><span class="hs-identifier hs-var">cts</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-963"></span><span>
</span><span id="line-964"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#addHoles"><span class="hs-identifier hs-type">addHoles</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Hole"><span class="hs-identifier hs-type">Hole</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span>
</span><span id="line-965"></span><span id="addHoles"><span class="annot"><span class="annottext">addHoles :: WantedConstraints -&gt; Bag Hole -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#addHoles"><span class="hs-identifier hs-var hs-var">addHoles</span></a></span></span><span> </span><span id="local-6989586621680916652"><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916652"><span class="hs-identifier hs-var">wc</span></a></span></span><span> </span><span id="local-6989586621680916651"><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916651"><span class="hs-identifier hs-var">holes</span></a></span></span><span>
</span><span id="line-966"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916652"><span class="hs-identifier hs-var">wc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_holes :: Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var">wc_holes</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916651"><span class="hs-identifier hs-var">holes</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Hole -&gt; Bag Hole -&gt; Bag Hole
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var hs-var">wc_holes</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916652"><span class="hs-identifier hs-var">wc</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-967"></span><span>
</span><span id="line-968"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#dropMisleading"><span class="hs-identifier hs-type">dropMisleading</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span>
</span><span id="line-969"></span><span class="hs-comment">-- Drop misleading constraints; really just class constraints</span><span>
</span><span id="line-970"></span><span class="hs-comment">-- See Note [Constraints and errors] in GHC.Tc.Utils.Monad</span><span>
</span><span id="line-971"></span><span id="dropMisleading"><span class="annot"><span class="annottext">dropMisleading :: WantedConstraints -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#dropMisleading"><span class="hs-identifier hs-var hs-var">dropMisleading</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916650"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916650"><span class="hs-identifier hs-var">simples</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_impl :: WantedConstraints -&gt; Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916649"><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916649"><span class="hs-identifier hs-var">implics</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_holes :: WantedConstraints -&gt; Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var">wc_holes</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916648"><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916648"><span class="hs-identifier hs-var">holes</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-972"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WC :: Cts -&gt; Bag Implication -&gt; Bag Hole -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_simple :: Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Ct -&gt; Bool) -&gt; Cts -&gt; Cts
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#filterBag"><span class="hs-identifier hs-var">filterBag</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Bool
</span><a href="#local-6989586621680916646"><span class="hs-identifier hs-var">keep_ct</span></a></span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916650"><span class="hs-identifier hs-var">simples</span></a></span><span>
</span><span id="line-973"></span><span>       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_impl :: Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Implication -&gt; Implication) -&gt; Bag Implication -&gt; Bag Implication
forall a b. (a -&gt; b) -&gt; Bag a -&gt; Bag b
</span><a href="GHC.Data.Bag.html#mapBag"><span class="hs-identifier hs-var">mapBag</span></a></span><span> </span><span class="annot"><span class="annottext">Implication -&gt; Implication
</span><a href="#local-6989586621680916644"><span class="hs-identifier hs-var">drop_implic</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916649"><span class="hs-identifier hs-var">implics</span></a></span><span>
</span><span id="line-974"></span><span>       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_holes :: Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var">wc_holes</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Hole -&gt; Bool) -&gt; Bag Hole -&gt; Bag Hole
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#filterBag"><span class="hs-identifier hs-var">filterBag</span></a></span><span> </span><span class="annot"><span class="annottext">Hole -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isOutOfScopeHole"><span class="hs-identifier hs-var">isOutOfScopeHole</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916648"><span class="hs-identifier hs-var">holes</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-975"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-976"></span><span>    </span><span id="local-6989586621680916644"><span class="annot"><span class="annottext">drop_implic :: Implication -&gt; Implication
</span><a href="#local-6989586621680916644"><span class="hs-identifier hs-var hs-var">drop_implic</span></a></span></span><span> </span><span id="local-6989586621680916643"><span class="annot"><span class="annottext">Implication
</span><a href="#local-6989586621680916643"><span class="hs-identifier hs-var">implic</span></a></span></span><span>
</span><span id="line-977"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Implication
</span><a href="#local-6989586621680916643"><span class="hs-identifier hs-var">implic</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ic_wanted :: WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#ic_wanted"><span class="hs-identifier hs-var">ic_wanted</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#dropMisleading"><span class="hs-identifier hs-var">dropMisleading</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Implication -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#ic_wanted"><span class="hs-identifier hs-var hs-var">ic_wanted</span></a></span><span> </span><span class="annot"><span class="annottext">Implication
</span><a href="#local-6989586621680916643"><span class="hs-identifier hs-var">implic</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-978"></span><span>    </span><span id="local-6989586621680916646"><span class="annot"><span class="annottext">keep_ct :: Ct -&gt; Bool
</span><a href="#local-6989586621680916646"><span class="hs-identifier hs-var hs-var">keep_ct</span></a></span></span><span> </span><span id="local-6989586621680916642"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916642"><span class="hs-identifier hs-var">ct</span></a></span></span><span>
</span><span id="line-979"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Xi -&gt; Pred
</span><a href="GHC.Core.Predicate.html#classifyPredType"><span class="hs-identifier hs-var">classifyPredType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#ctPred"><span class="hs-identifier hs-var">ctPred</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916642"><span class="hs-identifier hs-var">ct</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-980"></span><span>          </span><span class="annot"><a href="GHC.Core.Predicate.html#ClassPred"><span class="hs-identifier hs-type">ClassPred</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-981"></span><span>          </span><span class="annot"><span class="annottext">Pred
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-982"></span><span>
</span><span id="line-983"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isSolvedStatus"><span class="hs-identifier hs-type">isSolvedStatus</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ImplicStatus"><span class="hs-identifier hs-type">ImplicStatus</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-984"></span><span id="isSolvedStatus"><span class="annot"><span class="annottext">isSolvedStatus :: ImplicStatus -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isSolvedStatus"><span class="hs-identifier hs-var hs-var">isSolvedStatus</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#IC_Solved"><span class="hs-identifier hs-type">IC_Solved</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-985"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isSolvedStatus"><span class="hs-identifier hs-var">isSolvedStatus</span></a></span><span> </span><span class="annot"><span class="annottext">ImplicStatus
</span><span class="hs-identifier">_</span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-986"></span><span>
</span><span id="line-987"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isInsolubleStatus"><span class="hs-identifier hs-type">isInsolubleStatus</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ImplicStatus"><span class="hs-identifier hs-type">ImplicStatus</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-988"></span><span id="isInsolubleStatus"><span class="annot"><span class="annottext">isInsolubleStatus :: ImplicStatus -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isInsolubleStatus"><span class="hs-identifier hs-var hs-var">isInsolubleStatus</span></a></span></span><span> </span><span class="annot"><span class="annottext">ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#IC_Insoluble"><span class="hs-identifier hs-var">IC_Insoluble</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-989"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isInsolubleStatus"><span class="hs-identifier hs-var">isInsolubleStatus</span></a></span><span> </span><span class="annot"><span class="annottext">ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#IC_BadTelescope"><span class="hs-identifier hs-var">IC_BadTelescope</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-990"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isInsolubleStatus"><span class="hs-identifier hs-var">isInsolubleStatus</span></a></span><span> </span><span class="annot"><span class="annottext">ImplicStatus
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-991"></span><span>
</span><span id="line-992"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#insolubleImplic"><span class="hs-identifier hs-type">insolubleImplic</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Implication"><span class="hs-identifier hs-type">Implication</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-993"></span><span id="insolubleImplic"><span class="annot"><span class="annottext">insolubleImplic :: Implication -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#insolubleImplic"><span class="hs-identifier hs-var hs-var">insolubleImplic</span></a></span></span><span> </span><span id="local-6989586621680916636"><span class="annot"><span class="annottext">Implication
</span><a href="#local-6989586621680916636"><span class="hs-identifier hs-var">ic</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImplicStatus -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isInsolubleStatus"><span class="hs-identifier hs-var">isInsolubleStatus</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Implication -&gt; ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#ic_status"><span class="hs-identifier hs-var hs-var">ic_status</span></a></span><span> </span><span class="annot"><span class="annottext">Implication
</span><a href="#local-6989586621680916636"><span class="hs-identifier hs-var">ic</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-994"></span><span>
</span><span id="line-995"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#insolubleWC"><span class="hs-identifier hs-type">insolubleWC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-996"></span><span id="insolubleWC"><span class="annot"><span class="annottext">insolubleWC :: WantedConstraints -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#insolubleWC"><span class="hs-identifier hs-var hs-var">insolubleWC</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">wc_impl :: WantedConstraints -&gt; Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916635"><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916635"><span class="hs-identifier hs-var">implics</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_simple :: WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916634"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916634"><span class="hs-identifier hs-var">simples</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_holes :: WantedConstraints -&gt; Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var">wc_holes</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916633"><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916633"><span class="hs-identifier hs-var">holes</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-997"></span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">(Ct -&gt; Bool) -&gt; Cts -&gt; Bool
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier hs-var">anyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#insolubleCt"><span class="hs-identifier hs-var">insolubleCt</span></a></span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916634"><span class="hs-identifier hs-var">simples</span></a></span><span>
</span><span id="line-998"></span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">(Implication -&gt; Bool) -&gt; Bag Implication -&gt; Bool
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier hs-var">anyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Implication -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#insolubleImplic"><span class="hs-identifier hs-var">insolubleImplic</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916635"><span class="hs-identifier hs-var">implics</span></a></span><span>
</span><span id="line-999"></span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">(Hole -&gt; Bool) -&gt; Bag Hole -&gt; Bool
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier hs-var">anyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Hole -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isOutOfScopeHole"><span class="hs-identifier hs-var">isOutOfScopeHole</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916633"><span class="hs-identifier hs-var">holes</span></a></span><span>  </span><span class="hs-comment">-- See Note [Insoluble holes]</span><span>
</span><span id="line-1000"></span><span>
</span><span id="line-1001"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#insolubleCt"><span class="hs-identifier hs-type">insolubleCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1002"></span><span class="hs-comment">-- Definitely insoluble, in particular /excluding/ type-hole constraints</span><span>
</span><span id="line-1003"></span><span class="hs-comment">-- Namely: a) an equality constraint</span><span>
</span><span id="line-1004"></span><span class="hs-comment">--         b) that is insoluble</span><span>
</span><span id="line-1005"></span><span class="hs-comment">--         c) and does not arise from a Given</span><span>
</span><span id="line-1006"></span><span id="insolubleCt"><span class="annot"><span class="annottext">insolubleCt :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#insolubleCt"><span class="hs-identifier hs-var hs-var">insolubleCt</span></a></span></span><span> </span><span id="local-6989586621680916632"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916632"><span class="hs-identifier hs-var">ct</span></a></span></span><span>
</span><span id="line-1007"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#insolubleEqCt"><span class="hs-identifier hs-var">insolubleEqCt</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916632"><span class="hs-identifier hs-var">ct</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1008"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#arisesFromGivens"><span class="hs-identifier hs-var">arisesFromGivens</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916632"><span class="hs-identifier hs-var">ct</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>              </span><span class="hs-comment">-- See Note [Given insolubles]</span><span>
</span><span id="line-1009"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1010"></span><span>
</span><span id="line-1011"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#insolubleEqCt"><span class="hs-identifier hs-type">insolubleEqCt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1012"></span><span class="hs-comment">-- Returns True of /equality/ constraints</span><span>
</span><span id="line-1013"></span><span class="hs-comment">-- that are /definitely/ insoluble</span><span>
</span><span id="line-1014"></span><span class="hs-comment">-- It won't detect some definite errors like</span><span>
</span><span id="line-1015"></span><span class="hs-comment">--       F a ~ T (F a)</span><span>
</span><span id="line-1016"></span><span class="hs-comment">-- where F is a type family, which actually has an occurs check</span><span>
</span><span id="line-1017"></span><span class="hs-comment">--</span><span>
</span><span id="line-1018"></span><span class="hs-comment">-- The function is tuned for application /after/ constraint solving</span><span>
</span><span id="line-1019"></span><span class="hs-comment">--       i.e. assuming canonicalisation has been done</span><span>
</span><span id="line-1020"></span><span class="hs-comment">-- E.g.  It'll reply True  for     a ~ [a]</span><span>
</span><span id="line-1021"></span><span class="hs-comment">--               but False for   [a] ~ a</span><span>
</span><span id="line-1022"></span><span class="hs-comment">-- and</span><span>
</span><span id="line-1023"></span><span class="hs-comment">--                   True for  Int ~ F a Int</span><span>
</span><span id="line-1024"></span><span class="hs-comment">--               but False for  Maybe Int ~ F a Int Int</span><span>
</span><span id="line-1025"></span><span class="hs-comment">--               (where F is an arity-1 type function)</span><span>
</span><span id="line-1026"></span><span id="insolubleEqCt"><span class="annot"><span class="annottext">insolubleEqCt :: Ct -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#insolubleEqCt"><span class="hs-identifier hs-var hs-var">insolubleEqCt</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CIrredCan"><span class="hs-identifier hs-type">CIrredCan</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_status :: Ct -&gt; CtIrredStatus
</span><a href="GHC.Tc.Types.Constraint.html#cc_status"><span class="hs-identifier hs-var">cc_status</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtIrredStatus
</span><a href="GHC.Tc.Types.Constraint.html#InsolubleCIS"><span class="hs-identifier hs-var">InsolubleCIS</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1027"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#insolubleEqCt"><span class="hs-identifier hs-var">insolubleEqCt</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><span class="hs-identifier">_</span></span><span>                                        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1028"></span><span>
</span><span id="line-1029"></span><span class="hs-comment">-- | Does this hole represent an &quot;out of scope&quot; error?</span><span>
</span><span id="line-1030"></span><span class="hs-comment">-- See Note [Insoluble holes]</span><span>
</span><span id="line-1031"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isOutOfScopeHole"><span class="hs-identifier hs-type">isOutOfScopeHole</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Hole"><span class="hs-identifier hs-type">Hole</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1032"></span><span id="isOutOfScopeHole"><span class="annot"><span class="annottext">isOutOfScopeHole :: Hole -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isOutOfScopeHole"><span class="hs-identifier hs-var hs-var">isOutOfScopeHole</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Hole"><span class="hs-identifier hs-type">Hole</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">hole_occ :: Hole -&gt; OccName
</span><a href="GHC.Tc.Types.Constraint.html#hole_occ"><span class="hs-identifier hs-var">hole_occ</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916631"><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621680916631"><span class="hs-identifier hs-var">occ</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName -&gt; Bool
</span><a href="GHC.Types.Name.Occurrence.html#startsWithUnderscore"><span class="hs-identifier hs-var">startsWithUnderscore</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621680916631"><span class="hs-identifier hs-var">occ</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1033"></span><span>
</span><span id="line-1034"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680916627"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1035"></span><span>  </span><span id="local-6989586621680916623"><span class="annot"><span class="annottext">ppr :: WantedConstraints -&gt; SDoc
</span><a href="#local-6989586621680916623"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WC"><span class="hs-identifier hs-type">WC</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">wc_simple :: WantedConstraints -&gt; Cts
</span><a href="GHC.Tc.Types.Constraint.html#wc_simple"><span class="hs-identifier hs-var">wc_simple</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916622"><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916622"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_impl :: WantedConstraints -&gt; Bag Implication
</span><a href="GHC.Tc.Types.Constraint.html#wc_impl"><span class="hs-identifier hs-var">wc_impl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916621"><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916621"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">wc_holes :: WantedConstraints -&gt; Bag Hole
</span><a href="GHC.Tc.Types.Constraint.html#wc_holes"><span class="hs-identifier hs-var">wc_holes</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916620"><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916620"><span class="hs-identifier hs-var">h</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1036"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;WC&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span>
</span><span id="line-1037"></span><span>        </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Cts -&gt; SDoc
forall a. Outputable a =&gt; SDoc -&gt; Bag a -&gt; SDoc
</span><a href="GHC.Tc.Types.Constraint.html#ppr_bag"><span class="hs-identifier hs-var">ppr_bag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;wc_simple&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Cts
</span><a href="#local-6989586621680916622"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1038"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Bag Implication -&gt; SDoc
forall a. Outputable a =&gt; SDoc -&gt; Bag a -&gt; SDoc
</span><a href="GHC.Tc.Types.Constraint.html#ppr_bag"><span class="hs-identifier hs-var">ppr_bag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;wc_impl&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bag Implication
</span><a href="#local-6989586621680916621"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-1039"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Bag Hole -&gt; SDoc
forall a. Outputable a =&gt; SDoc -&gt; Bag a -&gt; SDoc
</span><a href="GHC.Tc.Types.Constraint.html#ppr_bag"><span class="hs-identifier hs-var">ppr_bag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;wc_holes&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bag Hole
</span><a href="#local-6989586621680916620"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1040"></span><span>
</span><span id="line-1041"></span><span id="local-6989586621680917119"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ppr_bag"><span class="hs-identifier hs-type">ppr_bag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680917119"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680917119"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span></span><span>
</span><span id="line-1042"></span><span id="ppr_bag"><span class="annot"><span class="annottext">ppr_bag :: forall a. Outputable a =&gt; SDoc -&gt; Bag a -&gt; SDoc
</span><a href="GHC.Tc.Types.Constraint.html#ppr_bag"><span class="hs-identifier hs-var hs-var">ppr_bag</span></a></span></span><span> </span><span id="local-6989586621680916615"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680916615"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span id="local-6989586621680916614"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680916614"><span class="hs-identifier hs-var">bag</span></a></span></span><span>
</span><span id="line-1043"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Bool
forall a. Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#isEmptyBag"><span class="hs-identifier hs-var">isEmptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680916614"><span class="hs-identifier hs-var">bag</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1044"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680916615"><span class="hs-identifier hs-var">doc</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#equals"><span class="hs-identifier hs-var">equals</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1045"></span><span>                       </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; SDoc -&gt; SDoc) -&gt; SDoc -&gt; Bag a -&gt; SDoc
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">($$)</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc -&gt; SDoc) -&gt; (a -&gt; SDoc) -&gt; a -&gt; SDoc -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680916614"><span class="hs-identifier hs-var">bag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1046"></span><span>
</span><span id="line-1047"></span><span class="hs-comment">{- Note [Given insolubles]
~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider (#14325, comment:)
    class (a~b) =&gt; C a b

    foo :: C a c =&gt; a -&gt; c
    foo x = x

    hm3 :: C (f b) b =&gt; b -&gt; f b
    hm3 x = foo x

In the RHS of hm3, from the [G] C (f b) b we get the insoluble
[G] f b ~# b.  Then we also get an unsolved [W] C b (f b).
Residual implication looks like
    forall b. C (f b) b =&gt; [G] f b ~# b
                           [W] C f (f b)

We do /not/ want to set the implication status to IC_Insoluble,
because that'll suppress reports of [W] C b (f b).  But we
may not report the insoluble [G] f b ~# b either (see Note [Given errors]
in GHC.Tc.Errors), so we may fail to report anything at all!  Yikes.

The same applies to Derived constraints that /arise from/ Givens.
E.g.   f :: (C Int [a]) =&gt; blah
where a fundep means we get
       [D] Int ~ [a]
By the same reasoning we must not suppress other errors (#15767)

Bottom line: insolubleWC (called in GHC.Tc.Solver.setImplicationStatus)
             should ignore givens even if they are insoluble.

Note [Insoluble holes]
~~~~~~~~~~~~~~~~~~~~~~
Hole constraints that ARE NOT treated as truly insoluble:
  a) type holes, arising from PartialTypeSignatures,
  b) &quot;true&quot; expression holes arising from TypedHoles

An &quot;expression hole&quot; or &quot;type hole&quot; isn't really an error
at all; it's a report saying &quot;_ :: Int&quot; here.  But an out-of-scope
variable masquerading as expression holes IS treated as truly
insoluble, so that it trumps other errors during error reporting.
Yuk!

************************************************************************
*                                                                      *
                Implication constraints
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-1096"></span><span>
</span><span id="line-1097"></span><span class="hs-keyword">data</span><span> </span><span id="Implication"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Implication"><span class="hs-identifier hs-var">Implication</span></a></span></span><span>
</span><span id="line-1098"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="Implic"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Implic"><span class="hs-identifier hs-var">Implic</span></a></span></span><span> </span><span class="hs-special">{</span><span>   </span><span class="hs-comment">-- Invariants for a tree of implications:</span><span>
</span><span id="line-1099"></span><span>               </span><span class="hs-comment">-- see TcType Note [TcLevel and untouchable type variables]</span><span>
</span><span id="line-1100"></span><span>
</span><span id="line-1101"></span><span>      </span><span id="ic_tclvl"><span class="annot"><span class="annottext">Implication -&gt; TcLevel
</span><a href="GHC.Tc.Types.Constraint.html#ic_tclvl"><span class="hs-identifier hs-var hs-var">ic_tclvl</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span class="hs-special">,</span><span>       </span><span class="hs-comment">-- TcLevel of unification variables</span><span>
</span><span id="line-1102"></span><span>                                 </span><span class="hs-comment">-- allocated /inside/ this implication</span><span>
</span><span id="line-1103"></span><span>
</span><span id="line-1104"></span><span>      </span><span id="ic_skols"><span class="annot"><span class="annottext">Implication -&gt; [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#ic_skols"><span class="hs-identifier hs-var hs-var">ic_skols</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- Introduced skolems</span><span>
</span><span id="line-1105"></span><span>      </span><span id="ic_info"><span class="annot"><span class="annottext">Implication -&gt; SkolemInfo
</span><a href="GHC.Tc.Types.Constraint.html#ic_info"><span class="hs-identifier hs-var hs-var">ic_info</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#SkolemInfo"><span class="hs-identifier hs-type">SkolemInfo</span></a></span><span class="hs-special">,</span><span>    </span><span class="hs-comment">-- See Note [Skolems in an implication]</span><span>
</span><span id="line-1106"></span><span>                                 </span><span class="hs-comment">-- See Note [Shadowing in a constraint]</span><span>
</span><span id="line-1107"></span><span>
</span><span id="line-1108"></span><span>      </span><span id="ic_given"><span class="annot"><span class="annottext">Implication -&gt; [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#ic_given"><span class="hs-identifier hs-var hs-var">ic_given</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>      </span><span class="hs-comment">-- Given evidence variables</span><span>
</span><span id="line-1109"></span><span>                                 </span><span class="hs-comment">--   (order does not matter)</span><span>
</span><span id="line-1110"></span><span>                                 </span><span class="hs-comment">-- See Invariant (GivenInv) in GHC.Tc.Utils.TcType</span><span>
</span><span id="line-1111"></span><span>
</span><span id="line-1112"></span><span>      </span><span id="ic_no_eqs"><span class="annot"><span class="annottext">Implication -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#ic_no_eqs"><span class="hs-identifier hs-var hs-var">ic_no_eqs</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span>         </span><span class="hs-comment">-- True  &lt;=&gt; ic_givens have no equalities, for sure</span><span>
</span><span id="line-1113"></span><span>                                 </span><span class="hs-comment">-- False &lt;=&gt; ic_givens might have equalities</span><span>
</span><span id="line-1114"></span><span>
</span><span id="line-1115"></span><span>      </span><span id="ic_warn_inaccessible"><span class="annot"><span class="annottext">Implication -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#ic_warn_inaccessible"><span class="hs-identifier hs-var hs-var">ic_warn_inaccessible</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span>
</span><span id="line-1116"></span><span>                                 </span><span class="hs-comment">-- True  &lt;=&gt; -Winaccessible-code is enabled</span><span>
</span><span id="line-1117"></span><span>                                 </span><span class="hs-comment">-- at construction. See</span><span>
</span><span id="line-1118"></span><span>                                 </span><span class="hs-comment">-- Note [Avoid -Winaccessible-code when deriving]</span><span>
</span><span id="line-1119"></span><span>                                 </span><span class="hs-comment">-- in GHC.Tc.TyCl.Instance</span><span>
</span><span id="line-1120"></span><span>
</span><span id="line-1121"></span><span>      </span><span id="ic_env"><span class="annot"><span class="annottext">Implication -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ic_env"><span class="hs-identifier hs-var hs-var">ic_env</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1122"></span><span>                                 </span><span class="hs-comment">-- Records the TcLClEnv at the time of creation.</span><span>
</span><span id="line-1123"></span><span>                                 </span><span class="hs-comment">--</span><span>
</span><span id="line-1124"></span><span>                                 </span><span class="hs-comment">-- The TcLclEnv gives the source location</span><span>
</span><span id="line-1125"></span><span>                                 </span><span class="hs-comment">-- and error context for the implication, and</span><span>
</span><span id="line-1126"></span><span>                                 </span><span class="hs-comment">-- hence for all the given evidence variables.</span><span>
</span><span id="line-1127"></span><span>
</span><span id="line-1128"></span><span>      </span><span id="ic_wanted"><span class="annot"><span class="annottext">Implication -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#ic_wanted"><span class="hs-identifier hs-var hs-var">ic_wanted</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WantedConstraints"><span class="hs-identifier hs-type">WantedConstraints</span></a></span><span class="hs-special">,</span><span>  </span><span class="hs-comment">-- The wanteds</span><span>
</span><span id="line-1129"></span><span>                                       </span><span class="hs-comment">-- See Invariang (WantedInf) in GHC.Tc.Utils.TcType</span><span>
</span><span id="line-1130"></span><span>
</span><span id="line-1131"></span><span>      </span><span id="ic_binds"><span class="annot"><span class="annottext">Implication -&gt; EvBindsVar
</span><a href="GHC.Tc.Types.Constraint.html#ic_binds"><span class="hs-identifier hs-var hs-var">ic_binds</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#EvBindsVar"><span class="hs-identifier hs-type">EvBindsVar</span></a></span><span class="hs-special">,</span><span>    </span><span class="hs-comment">-- Points to the place to fill in the</span><span>
</span><span id="line-1132"></span><span>                                  </span><span class="hs-comment">-- abstraction and bindings.</span><span>
</span><span id="line-1133"></span><span>
</span><span id="line-1134"></span><span>      </span><span class="hs-comment">-- The ic_need fields keep track of which Given evidence</span><span>
</span><span id="line-1135"></span><span>      </span><span class="hs-comment">-- is used by this implication or its children</span><span>
</span><span id="line-1136"></span><span>      </span><span class="hs-comment">-- NB: including stuff used by nested implications that have since</span><span>
</span><span id="line-1137"></span><span>      </span><span class="hs-comment">--     been discarded</span><span>
</span><span id="line-1138"></span><span>      </span><span class="hs-comment">-- See Note [Needed evidence variables]</span><span>
</span><span id="line-1139"></span><span>      </span><span id="ic_need_inner"><span class="annot"><span class="annottext">Implication -&gt; TcTyCoVarSet
</span><a href="GHC.Tc.Types.Constraint.html#ic_need_inner"><span class="hs-identifier hs-var hs-var">ic_need_inner</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#VarSet"><span class="hs-identifier hs-type">VarSet</span></a></span><span class="hs-special">,</span><span>    </span><span class="hs-comment">-- Includes all used Given evidence</span><span>
</span><span id="line-1140"></span><span>      </span><span id="ic_need_outer"><span class="annot"><span class="annottext">Implication -&gt; TcTyCoVarSet
</span><a href="GHC.Tc.Types.Constraint.html#ic_need_outer"><span class="hs-identifier hs-var hs-var">ic_need_outer</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#VarSet"><span class="hs-identifier hs-type">VarSet</span></a></span><span class="hs-special">,</span><span>    </span><span class="hs-comment">-- Includes only the free Given evidence</span><span>
</span><span id="line-1141"></span><span>                                  </span><span class="hs-comment">--  i.e. ic_need_inner after deleting</span><span>
</span><span id="line-1142"></span><span>                                  </span><span class="hs-comment">--       (a) givens (b) binders of ic_binds</span><span>
</span><span id="line-1143"></span><span>
</span><span id="line-1144"></span><span>      </span><span id="ic_status"><span class="annot"><span class="annottext">Implication -&gt; ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#ic_status"><span class="hs-identifier hs-var hs-var">ic_status</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ImplicStatus"><span class="hs-identifier hs-type">ImplicStatus</span></a></span><span>
</span><span id="line-1145"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-1146"></span><span>
</span><span id="line-1147"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#implicationPrototype"><span class="hs-identifier hs-type">implicationPrototype</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Implication"><span class="hs-identifier hs-type">Implication</span></a></span><span>
</span><span id="line-1148"></span><span id="implicationPrototype"><span class="annot"><span class="annottext">implicationPrototype :: Implication
</span><a href="GHC.Tc.Types.Constraint.html#implicationPrototype"><span class="hs-identifier hs-var hs-var">implicationPrototype</span></a></span></span><span>
</span><span id="line-1149"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Implic :: TcLevel
-&gt; [EvVar]
-&gt; SkolemInfo
-&gt; [EvVar]
-&gt; Bool
-&gt; Bool
-&gt; TcLclEnv
-&gt; WantedConstraints
-&gt; EvBindsVar
-&gt; TcTyCoVarSet
-&gt; TcTyCoVarSet
-&gt; ImplicStatus
-&gt; Implication
</span><a href="GHC.Tc.Types.Constraint.html#Implic"><span class="hs-identifier hs-type">Implic</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-comment">-- These fields must be initialised</span><span>
</span><span id="line-1150"></span><span>              </span><span class="annot"><span class="annottext">ic_tclvl :: TcLevel
</span><a href="GHC.Tc.Types.Constraint.html#ic_tclvl"><span class="hs-identifier hs-var">ic_tclvl</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; TcLevel
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;newImplic:tclvl&quot;</span></span><span>
</span><span id="line-1151"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_binds :: EvBindsVar
</span><a href="GHC.Tc.Types.Constraint.html#ic_binds"><span class="hs-identifier hs-var">ic_binds</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; EvBindsVar
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;newImplic:binds&quot;</span></span><span>
</span><span id="line-1152"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_info :: SkolemInfo
</span><a href="GHC.Tc.Types.Constraint.html#ic_info"><span class="hs-identifier hs-var">ic_info</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SkolemInfo
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;newImplic:info&quot;</span></span><span>
</span><span id="line-1153"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_env :: TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ic_env"><span class="hs-identifier hs-var">ic_env</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; TcLclEnv
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;newImplic:env&quot;</span></span><span>
</span><span id="line-1154"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_warn_inaccessible :: Bool
</span><a href="GHC.Tc.Types.Constraint.html#ic_warn_inaccessible"><span class="hs-identifier hs-var">ic_warn_inaccessible</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Bool
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;newImplic:warn_inaccessible&quot;</span></span><span>
</span><span id="line-1155"></span><span>
</span><span id="line-1156"></span><span>              </span><span class="hs-comment">-- The rest have sensible default values</span><span>
</span><span id="line-1157"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_skols :: [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#ic_skols"><span class="hs-identifier hs-var">ic_skols</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1158"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_given :: [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#ic_given"><span class="hs-identifier hs-var">ic_given</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1159"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_wanted :: WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#ic_wanted"><span class="hs-identifier hs-var">ic_wanted</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#emptyWC"><span class="hs-identifier hs-var">emptyWC</span></a></span><span>
</span><span id="line-1160"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_no_eqs :: Bool
</span><a href="GHC.Tc.Types.Constraint.html#ic_no_eqs"><span class="hs-identifier hs-var">ic_no_eqs</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1161"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_status :: ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#ic_status"><span class="hs-identifier hs-var">ic_status</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#IC_Unsolved"><span class="hs-identifier hs-var">IC_Unsolved</span></a></span><span>
</span><span id="line-1162"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_need_inner :: TcTyCoVarSet
</span><a href="GHC.Tc.Types.Constraint.html#ic_need_inner"><span class="hs-identifier hs-var">ic_need_inner</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyCoVarSet
</span><a href="GHC.Types.Var.Set.html#emptyVarSet"><span class="hs-identifier hs-var">emptyVarSet</span></a></span><span>
</span><span id="line-1163"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_need_outer :: TcTyCoVarSet
</span><a href="GHC.Tc.Types.Constraint.html#ic_need_outer"><span class="hs-identifier hs-var">ic_need_outer</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyCoVarSet
</span><a href="GHC.Types.Var.Set.html#emptyVarSet"><span class="hs-identifier hs-var">emptyVarSet</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1164"></span><span>
</span><span id="line-1165"></span><span class="hs-keyword">data</span><span> </span><span id="ImplicStatus"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ImplicStatus"><span class="hs-identifier hs-var">ImplicStatus</span></a></span></span><span>
</span><span id="line-1166"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="IC_Solved"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#IC_Solved"><span class="hs-identifier hs-var">IC_Solved</span></a></span></span><span>     </span><span class="hs-comment">-- All wanteds in the tree are solved, all the way down</span><span>
</span><span id="line-1167"></span><span>       </span><span class="hs-special">{</span><span> </span><span id="ics_dead"><span class="annot"><span class="annottext">ImplicStatus -&gt; [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#ics_dead"><span class="hs-identifier hs-var hs-var">ics_dead</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span>  </span><span class="hs-comment">-- Subset of ic_given that are not needed</span><span>
</span><span id="line-1168"></span><span>         </span><span class="hs-comment">-- See Note [Tracking redundant constraints] in GHC.Tc.Solver</span><span>
</span><span id="line-1169"></span><span>
</span><span id="line-1170"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="IC_Insoluble"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#IC_Insoluble"><span class="hs-identifier hs-var">IC_Insoluble</span></a></span></span><span>  </span><span class="hs-comment">-- At least one insoluble constraint in the tree</span><span>
</span><span id="line-1171"></span><span>
</span><span id="line-1172"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="IC_BadTelescope"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#IC_BadTelescope"><span class="hs-identifier hs-var">IC_BadTelescope</span></a></span></span><span>  </span><span class="hs-comment">-- solved, but the skolems in the telescope are out of</span><span>
</span><span id="line-1173"></span><span>                     </span><span class="hs-comment">-- dependency order</span><span>
</span><span id="line-1174"></span><span>
</span><span id="line-1175"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="IC_Unsolved"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#IC_Unsolved"><span class="hs-identifier hs-var">IC_Unsolved</span></a></span></span><span>   </span><span class="hs-comment">-- Neither of the above; might go either way</span><span>
</span><span id="line-1176"></span><span>
</span><span id="line-1177"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680916595"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Implication"><span class="hs-identifier hs-type">Implication</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1178"></span><span>  </span><span id="local-6989586621680916583"><span class="annot"><span class="annottext">ppr :: Implication -&gt; SDoc
</span><a href="#local-6989586621680916583"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Implic"><span class="hs-identifier hs-type">Implic</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ic_tclvl :: Implication -&gt; TcLevel
</span><a href="GHC.Tc.Types.Constraint.html#ic_tclvl"><span class="hs-identifier hs-var">ic_tclvl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916582"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680916582"><span class="hs-identifier hs-var">tclvl</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_skols :: Implication -&gt; [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#ic_skols"><span class="hs-identifier hs-var">ic_skols</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916581"><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916581"><span class="hs-identifier hs-var">skols</span></a></span></span><span>
</span><span id="line-1179"></span><span>              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_given :: Implication -&gt; [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#ic_given"><span class="hs-identifier hs-var">ic_given</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916580"><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916580"><span class="hs-identifier hs-var">given</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_no_eqs :: Implication -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#ic_no_eqs"><span class="hs-identifier hs-var">ic_no_eqs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916579"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680916579"><span class="hs-identifier hs-var">no_eqs</span></a></span></span><span>
</span><span id="line-1180"></span><span>              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_wanted :: Implication -&gt; WantedConstraints
</span><a href="GHC.Tc.Types.Constraint.html#ic_wanted"><span class="hs-identifier hs-var">ic_wanted</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916578"><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916578"><span class="hs-identifier hs-var">wanted</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_status :: Implication -&gt; ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#ic_status"><span class="hs-identifier hs-var">ic_status</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916577"><span class="annot"><span class="annottext">ImplicStatus
</span><a href="#local-6989586621680916577"><span class="hs-identifier hs-var">status</span></a></span></span><span>
</span><span id="line-1181"></span><span>              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_binds :: Implication -&gt; EvBindsVar
</span><a href="GHC.Tc.Types.Constraint.html#ic_binds"><span class="hs-identifier hs-var">ic_binds</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916576"><span class="annot"><span class="annottext">EvBindsVar
</span><a href="#local-6989586621680916576"><span class="hs-identifier hs-var">binds</span></a></span></span><span>
</span><span id="line-1182"></span><span>              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_need_inner :: Implication -&gt; TcTyCoVarSet
</span><a href="GHC.Tc.Types.Constraint.html#ic_need_inner"><span class="hs-identifier hs-var">ic_need_inner</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916575"><span class="annot"><span class="annottext">TcTyCoVarSet
</span><a href="#local-6989586621680916575"><span class="hs-identifier hs-var">need_in</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_need_outer :: Implication -&gt; TcTyCoVarSet
</span><a href="GHC.Tc.Types.Constraint.html#ic_need_outer"><span class="hs-identifier hs-var">ic_need_outer</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916574"><span class="annot"><span class="annottext">TcTyCoVarSet
</span><a href="#local-6989586621680916574"><span class="hs-identifier hs-var">need_out</span></a></span></span><span>
</span><span id="line-1183"></span><span>              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ic_info :: Implication -&gt; SkolemInfo
</span><a href="GHC.Tc.Types.Constraint.html#ic_info"><span class="hs-identifier hs-var">ic_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916573"><span class="annot"><span class="annottext">SkolemInfo
</span><a href="#local-6989586621680916573"><span class="hs-identifier hs-var">info</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1184"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Implic&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#lbrace"><span class="hs-identifier hs-var">lbrace</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1185"></span><span>        </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#sep"><span class="hs-identifier hs-var">sep</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;TcLevel =&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680916582"><span class="hs-identifier hs-var">tclvl</span></a></span><span>
</span><span id="line-1186"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Skolems =&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[EvVar] -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprTyVars"><span class="hs-identifier hs-var">pprTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916581"><span class="hs-identifier hs-var">skols</span></a></span><span>
</span><span id="line-1187"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;No-eqs =&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680916579"><span class="hs-identifier hs-var">no_eqs</span></a></span><span>
</span><span id="line-1188"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Status =&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ImplicStatus -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ImplicStatus
</span><a href="#local-6989586621680916577"><span class="hs-identifier hs-var">status</span></a></span><span>
</span><span id="line-1189"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Given =&quot;</span></span><span class="hs-special">)</span><span>  </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[EvVar] -&gt; SDoc
</span><a href="GHC.Tc.Types.Constraint.html#pprEvVars"><span class="hs-identifier hs-var">pprEvVars</span></a></span><span> </span><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916580"><span class="hs-identifier hs-var">given</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1190"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Wanted =&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WantedConstraints -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621680916578"><span class="hs-identifier hs-var">wanted</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1191"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Binds =&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">EvBindsVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">EvBindsVar
</span><a href="#local-6989586621680916576"><span class="hs-identifier hs-var">binds</span></a></span><span>
</span><span id="line-1192"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#whenPprDebug"><span class="hs-identifier hs-var">whenPprDebug</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Needed inner =&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyCoVarSet -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyCoVarSet
</span><a href="#local-6989586621680916575"><span class="hs-identifier hs-var">need_in</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1193"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#whenPprDebug"><span class="hs-identifier hs-var">whenPprDebug</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Needed outer =&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyCoVarSet -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyCoVarSet
</span><a href="#local-6989586621680916574"><span class="hs-identifier hs-var">need_out</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1194"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SkolemInfo -&gt; SDoc
</span><a href="GHC.Tc.Types.Origin.html#pprSkolInfo"><span class="hs-identifier hs-var">pprSkolInfo</span></a></span><span> </span><span class="annot"><span class="annottext">SkolemInfo
</span><a href="#local-6989586621680916573"><span class="hs-identifier hs-var">info</span></a></span><span> </span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#rbrace"><span class="hs-identifier hs-var">rbrace</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1195"></span><span>
</span><span id="line-1196"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680916564"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ImplicStatus"><span class="hs-identifier hs-type">ImplicStatus</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1197"></span><span>  </span><span id="local-6989586621680916561"><span class="annot"><span class="annottext">ppr :: ImplicStatus -&gt; SDoc
</span><a href="#local-6989586621680916561"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#IC_Insoluble"><span class="hs-identifier hs-var">IC_Insoluble</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Insoluble&quot;</span></span><span>
</span><span id="line-1198"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#IC_BadTelescope"><span class="hs-identifier hs-var">IC_BadTelescope</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Bad telescope&quot;</span></span><span>
</span><span id="line-1199"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ImplicStatus
</span><a href="GHC.Tc.Types.Constraint.html#IC_Unsolved"><span class="hs-identifier hs-var">IC_Unsolved</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Unsolved&quot;</span></span><span>
</span><span id="line-1200"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#IC_Solved"><span class="hs-identifier hs-type">IC_Solved</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ics_dead :: ImplicStatus -&gt; [EvVar]
</span><a href="GHC.Tc.Types.Constraint.html#ics_dead"><span class="hs-identifier hs-var">ics_dead</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916560"><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916560"><span class="hs-identifier hs-var">dead</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1201"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Solved&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Dead givens =&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[EvVar] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916560"><span class="hs-identifier hs-var">dead</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1202"></span><span>
</span><span id="line-1203"></span><span class="hs-comment">{- Note [Checking telescopes]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When kind-checking a /user-written/ type, we might have a &quot;bad telescope&quot;
like this one:
  data SameKind :: forall k. k -&gt; k -&gt; Type
  type Foo :: forall a k (b :: k). SameKind a b -&gt; Type

The kind of 'a' mentions 'k' which is bound after 'a'.  Oops.

One approach to doing this would be to bring each of a, k, and b into
scope, one at a time, creating a separate implication constraint for
each one, and bumping the TcLevel. This would work, because the kind
of, say, a would be untouchable when k is in scope (and the constraint
couldn't float out because k blocks it). However, it leads to terrible
error messages, complaining about skolem escape. While it is indeed a
problem of skolem escape, we can do better.

Instead, our approach is to bring the block of variables into scope
all at once, creating one implication constraint for the lot:

* We make a single implication constraint when kind-checking
  the 'forall' in Foo's kind, something like
      forall a k (b::k). { wanted constraints }

* Having solved {wanted}, before discarding the now-solved implication,
  the constraint solver checks the dependency order of the skolem
  variables (ic_skols).  This is done in setImplicationStatus.

* This check is only necessary if the implication was born from a
  'forall' in a user-written signature (the HsForAllTy case in
  GHC.Tc.Gen.HsType.  If, say, it comes from checking a pattern match
  that binds existentials, where the type of the data constructor is
  known to be valid (it in tcConPat), no need for the check.

  So the check is done if and only if ic_info is ForAllSkol

* If ic_info is (ForAllSkol dt dvs), the dvs::SDoc displays the
  original, user-written type variables.

* Be careful /NOT/ to discard an implication with a ForAllSkol
  ic_info, even if ic_wanted is empty.  We must give the
  constraint solver a chance to make that bad-telescope test!  Hence
  the extra guard in emitResidualTvConstraint; see #16247

Note [Needed evidence variables]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Th ic_need_evs field holds the free vars of ic_binds, and all the
ic_binds in nested implications.

  * Main purpose: if one of the ic_givens is not mentioned in here, it
    is redundant.

  * solveImplication may drop an implication altogether if it has no
    remaining 'wanteds'. But we still track the free vars of its
    evidence binds, even though it has now disappeared.

Note [Shadowing in a constraint]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We assume NO SHADOWING in a constraint.  Specifically
 * The unification variables are all implicitly quantified at top
   level, and are all unique
 * The skolem variables bound in ic_skols are all freah when the
   implication is created.
So we can safely substitute. For example, if we have
   forall a.  a~Int =&gt; ...(forall b. ...a...)...
we can push the (a~Int) constraint inwards in the &quot;givens&quot; without
worrying that 'b' might clash.

Note [Skolems in an implication]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The skolems in an implication are not there to perform a skolem escape
check.  That happens because all the environment variables are in the
untouchables, and therefore cannot be unified with anything at all,
let alone the skolems.

Instead, ic_skols is used only when considering floating a constraint
outside the implication in GHC.Tc.Solver.floatEqualities or
GHC.Tc.Solver.approximateImplications

Note [Insoluble constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Some of the errors that we get during canonicalization are best
reported when all constraints have been simplified as much as
possible. For instance, assume that during simplification the
following constraints arise:

 [Wanted]   F alpha ~  uf1
 [Wanted]   beta ~ uf1 beta

When canonicalizing the wanted (beta ~ uf1 beta), if we eagerly fail
we will simply see a message:
    'Can't construct the infinite type  beta ~ uf1 beta'
and the user has no idea what the uf1 variable is.

Instead our plan is that we will NOT fail immediately, but:
    (1) Record the &quot;frozen&quot; error in the ic_insols field
    (2) Isolate the offending constraint from the rest of the inerts
    (3) Keep on simplifying/canonicalizing

At the end, we will hopefully have substituted uf1 := F alpha, and we
will be able to report a more informative error:
    'Can't construct the infinite type beta ~ F alpha beta'

Insoluble constraints *do* include Derived constraints. For example,
a functional dependency might give rise to [D] Int ~ Bool, and we must
report that.  If insolubles did not contain Deriveds, reportErrors would
never see it.


************************************************************************
*                                                                      *
            Pretty printing
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-1318"></span><span>
</span><span id="line-1319"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#pprEvVars"><span class="hs-identifier hs-type">pprEvVars</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>    </span><span class="hs-comment">-- Print with their types</span><span>
</span><span id="line-1320"></span><span id="pprEvVars"><span class="annot"><span class="annottext">pprEvVars :: [EvVar] -&gt; SDoc
</span><a href="GHC.Tc.Types.Constraint.html#pprEvVars"><span class="hs-identifier hs-var hs-var">pprEvVars</span></a></span></span><span> </span><span id="local-6989586621680916559"><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916559"><span class="hs-identifier hs-var">ev_vars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(EvVar -&gt; SDoc) -&gt; [EvVar] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar -&gt; SDoc
</span><a href="GHC.Tc.Types.Constraint.html#pprEvVarWithType"><span class="hs-identifier hs-var">pprEvVarWithType</span></a></span><span> </span><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916559"><span class="hs-identifier hs-var">ev_vars</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1321"></span><span>
</span><span id="line-1322"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#pprEvVarTheta"><span class="hs-identifier hs-type">pprEvVarTheta</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1323"></span><span id="pprEvVarTheta"><span class="annot"><span class="annottext">pprEvVarTheta :: [EvVar] -&gt; SDoc
</span><a href="GHC.Tc.Types.Constraint.html#pprEvVarTheta"><span class="hs-identifier hs-var hs-var">pprEvVarTheta</span></a></span></span><span> </span><span id="local-6989586621680916558"><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916558"><span class="hs-identifier hs-var">ev_vars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Xi] -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprTheta"><span class="hs-identifier hs-var">pprTheta</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(EvVar -&gt; Xi) -&gt; [EvVar] -&gt; [Xi]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar -&gt; Xi
</span><a href="GHC.Tc.Utils.TcType.html#evVarPred"><span class="hs-identifier hs-var">evVarPred</span></a></span><span> </span><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916558"><span class="hs-identifier hs-var">ev_vars</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1324"></span><span>
</span><span id="line-1325"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#pprEvVarWithType"><span class="hs-identifier hs-type">pprEvVarWithType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1326"></span><span id="pprEvVarWithType"><span class="annot"><span class="annottext">pprEvVarWithType :: EvVar -&gt; SDoc
</span><a href="GHC.Tc.Types.Constraint.html#pprEvVarWithType"><span class="hs-identifier hs-var hs-var">pprEvVarWithType</span></a></span></span><span> </span><span id="local-6989586621680916556"><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916556"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EvVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916556"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Xi -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprType"><span class="hs-identifier hs-var">pprType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EvVar -&gt; Xi
</span><a href="GHC.Tc.Utils.TcType.html#evVarPred"><span class="hs-identifier hs-var">evVarPred</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916556"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1327"></span><span>
</span><span id="line-1328"></span><span>
</span><span id="line-1329"></span><span>
</span><span id="line-1330"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#wrapType"><span class="hs-identifier hs-type">wrapType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-1331"></span><span id="wrapType"><span class="annot"><span class="annottext">wrapType :: Xi -&gt; [EvVar] -&gt; [Xi] -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#wrapType"><span class="hs-identifier hs-var hs-var">wrapType</span></a></span></span><span> </span><span id="local-6989586621680916553"><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916553"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621680916552"><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916552"><span class="hs-identifier hs-var">skols</span></a></span></span><span> </span><span id="local-6989586621680916551"><span class="annot"><span class="annottext">[Xi]
</span><a href="#local-6989586621680916551"><span class="hs-identifier hs-var">givens</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[EvVar] -&gt; Xi -&gt; Xi
</span><a href="GHC.Core.Type.html#mkSpecForAllTys"><span class="hs-identifier hs-var">mkSpecForAllTys</span></a></span><span> </span><span class="annot"><span class="annottext">[EvVar]
</span><a href="#local-6989586621680916552"><span class="hs-identifier hs-var">skols</span></a></span><span> </span><span class="annot"><span class="annottext">(Xi -&gt; Xi) -&gt; Xi -&gt; Xi
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Xi] -&gt; Xi -&gt; Xi
</span><a href="GHC.Tc.Utils.TcType.html#mkPhiTy"><span class="hs-identifier hs-var">mkPhiTy</span></a></span><span> </span><span class="annot"><span class="annottext">[Xi]
</span><a href="#local-6989586621680916551"><span class="hs-identifier hs-var">givens</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916553"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1332"></span><span>
</span><span id="line-1333"></span><span>
</span><span id="line-1334"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
            CtEvidence
*                                                                      *
************************************************************************

Note [Evidence field of CtEvidence]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
During constraint solving we never look at the type of ctev_evar/ctev_dest;
instead we look at the ctev_pred field.  The evtm/evar field
may be un-zonked.

Note [Bind new Givens immediately]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For Givens we make new EvVars and bind them immediately. Two main reasons:
  * Gain sharing.  E.g. suppose we start with g :: C a b, where
       class D a =&gt; C a b
       class (E a, F a) =&gt; D a
    If we generate all g's superclasses as separate EvTerms we might
    get    selD1 (selC1 g) :: E a
           selD2 (selC1 g) :: F a
           selC1 g :: D a
    which we could do more economically as:
           g1 :: D a = selC1 g
           g2 :: E a = selD1 g1
           g3 :: F a = selD2 g1

  * For *coercion* evidence we *must* bind each given:
      class (a~b) =&gt; C a b where ....
      f :: C a b =&gt; ....
    Then in f's Givens we have g:(C a b) and the superclass sc(g,0):a~b.
    But that superclass selector can't (yet) appear in a coercion
    (see evTermCoercion), so the easy thing is to bind it to an Id.

So a Given has EvVar inside it rather than (as previously) an EvTerm.

-}</span><span>
</span><span id="line-1372"></span><span>
</span><span id="line-1373"></span><span class="hs-comment">-- | A place for type-checking evidence to go after it is generated.</span><span>
</span><span id="line-1374"></span><span class="hs-comment">-- Wanted equalities are always HoleDest; other wanteds are always</span><span>
</span><span id="line-1375"></span><span class="hs-comment">-- EvVarDest.</span><span>
</span><span id="line-1376"></span><span class="hs-keyword">data</span><span> </span><span id="TcEvDest"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#TcEvDest"><span class="hs-identifier hs-var">TcEvDest</span></a></span></span><span>
</span><span id="line-1377"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="EvVarDest"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#EvVarDest"><span class="hs-identifier hs-var">EvVarDest</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span>         </span><span class="hs-comment">-- ^ bind this var to the evidence</span><span>
</span><span id="line-1378"></span><span>              </span><span class="hs-comment">-- EvVarDest is always used for non-type-equalities</span><span>
</span><span id="line-1379"></span><span>              </span><span class="hs-comment">-- e.g. class constraints</span><span>
</span><span id="line-1380"></span><span>
</span><span id="line-1381"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="HoleDest"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#HoleDest"><span class="hs-identifier hs-var">HoleDest</span></a></span></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionHole"><span class="hs-identifier hs-type">CoercionHole</span></a></span><span>  </span><span class="hs-comment">-- ^ fill in this hole with the evidence</span><span>
</span><span id="line-1382"></span><span>              </span><span class="hs-comment">-- HoleDest is always used for type-equalities</span><span>
</span><span id="line-1383"></span><span>              </span><span class="hs-comment">-- See Note [Coercion holes] in &quot;GHC.Core.TyCo.Rep&quot;</span><span>
</span><span id="line-1384"></span><span>
</span><span id="line-1385"></span><span class="hs-keyword">data</span><span> </span><span id="CtEvidence"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-var">CtEvidence</span></a></span></span><span>
</span><span id="line-1386"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="CtGiven"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtGiven"><span class="hs-identifier hs-var">CtGiven</span></a></span></span><span>    </span><span class="hs-comment">-- Truly given, not depending on subgoals</span><span>
</span><span id="line-1387"></span><span>      </span><span class="hs-special">{</span><span> </span><span id="ctev_pred"><span class="annot"><span class="annottext">CtEvidence -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#ctev_pred"><span class="hs-identifier hs-var hs-var">ctev_pred</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcPredType"><span class="hs-identifier hs-type">TcPredType</span></a></span><span>      </span><span class="hs-comment">-- See Note [Ct/evidence invariant]</span><span>
</span><span id="line-1388"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="ctev_evar"><span class="annot"><span class="annottext">CtEvidence -&gt; EvVar
</span><a href="GHC.Tc.Types.Constraint.html#ctev_evar"><span class="hs-identifier hs-var hs-var">ctev_evar</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span>           </span><span class="hs-comment">-- See Note [Evidence field of CtEvidence]</span><span>
</span><span id="line-1389"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="ctev_loc"><span class="annot"><span class="annottext">CtEvidence -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctev_loc"><span class="hs-identifier hs-var hs-var">ctev_loc</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1390"></span><span>
</span><span id="line-1391"></span><span>
</span><span id="line-1392"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="CtWanted"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtWanted"><span class="hs-identifier hs-var">CtWanted</span></a></span></span><span>   </span><span class="hs-comment">-- Wanted goal</span><span>
</span><span id="line-1393"></span><span>      </span><span class="hs-special">{</span><span> </span><span id="ctev_pred"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctev_pred"><span class="hs-identifier hs-var">ctev_pred</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcPredType"><span class="hs-identifier hs-type">TcPredType</span></a></span><span>     </span><span class="hs-comment">-- See Note [Ct/evidence invariant]</span><span>
</span><span id="line-1394"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="ctev_dest"><span class="annot"><span class="annottext">CtEvidence -&gt; TcEvDest
</span><a href="GHC.Tc.Types.Constraint.html#ctev_dest"><span class="hs-identifier hs-var hs-var">ctev_dest</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#TcEvDest"><span class="hs-identifier hs-type">TcEvDest</span></a></span><span>
</span><span id="line-1395"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="ctev_nosh"><span class="annot"><span class="annottext">CtEvidence -&gt; ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#ctev_nosh"><span class="hs-identifier hs-var hs-var">ctev_nosh</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ShadowInfo"><span class="hs-identifier hs-type">ShadowInfo</span></a></span><span>     </span><span class="hs-comment">-- See Note [Constraint flavours]</span><span>
</span><span id="line-1396"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="ctev_loc"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctev_loc"><span class="hs-identifier hs-var">ctev_loc</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1397"></span><span>
</span><span id="line-1398"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="CtDerived"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtDerived"><span class="hs-identifier hs-var">CtDerived</span></a></span></span><span>  </span><span class="hs-comment">-- A goal that we don't really have to solve and can't</span><span>
</span><span id="line-1399"></span><span>               </span><span class="hs-comment">-- immediately rewrite anything other than a derived</span><span>
</span><span id="line-1400"></span><span>               </span><span class="hs-comment">-- (there's no evidence!) but if we do manage to solve</span><span>
</span><span id="line-1401"></span><span>               </span><span class="hs-comment">-- it may help in solving other goals.</span><span>
</span><span id="line-1402"></span><span>      </span><span class="hs-special">{</span><span> </span><span id="ctev_pred"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctev_pred"><span class="hs-identifier hs-var">ctev_pred</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcPredType"><span class="hs-identifier hs-type">TcPredType</span></a></span><span>
</span><span id="line-1403"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="ctev_loc"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctev_loc"><span class="hs-identifier hs-var">ctev_loc</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1404"></span><span>
</span><span id="line-1405"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvPred"><span class="hs-identifier hs-type">ctEvPred</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcPredType"><span class="hs-identifier hs-type">TcPredType</span></a></span><span>
</span><span id="line-1406"></span><span class="hs-comment">-- The predicate of a flavor</span><span>
</span><span id="line-1407"></span><span id="ctEvPred"><span class="annot"><span class="annottext">ctEvPred :: CtEvidence -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#ctEvPred"><span class="hs-identifier hs-var hs-var">ctEvPred</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#ctev_pred"><span class="hs-identifier hs-var hs-var">ctev_pred</span></a></span><span>
</span><span id="line-1408"></span><span>
</span><span id="line-1409"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvLoc"><span class="hs-identifier hs-type">ctEvLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>
</span><span id="line-1410"></span><span id="ctEvLoc"><span class="annot"><span class="annottext">ctEvLoc :: CtEvidence -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctEvLoc"><span class="hs-identifier hs-var hs-var">ctEvLoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctev_loc"><span class="hs-identifier hs-var hs-var">ctev_loc</span></a></span><span>
</span><span id="line-1411"></span><span>
</span><span id="line-1412"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvOrigin"><span class="hs-identifier hs-type">ctEvOrigin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#CtOrigin"><span class="hs-identifier hs-type">CtOrigin</span></a></span><span>
</span><span id="line-1413"></span><span id="ctEvOrigin"><span class="annot"><span class="annottext">ctEvOrigin :: CtEvidence -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctEvOrigin"><span class="hs-identifier hs-var hs-var">ctEvOrigin</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctLocOrigin"><span class="hs-identifier hs-var">ctLocOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">(CtLoc -&gt; CtOrigin)
-&gt; (CtEvidence -&gt; CtLoc) -&gt; CtEvidence -&gt; CtOrigin
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctEvLoc"><span class="hs-identifier hs-var">ctEvLoc</span></a></span><span>
</span><span id="line-1414"></span><span>
</span><span id="line-1415"></span><span class="hs-comment">-- | Get the equality relation relevant for a 'CtEvidence'</span><span>
</span><span id="line-1416"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvEqRel"><span class="hs-identifier hs-type">ctEvEqRel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span>
</span><span id="line-1417"></span><span id="ctEvEqRel"><span class="annot"><span class="annottext">ctEvEqRel :: CtEvidence -&gt; EqRel
</span><a href="GHC.Tc.Types.Constraint.html#ctEvEqRel"><span class="hs-identifier hs-var hs-var">ctEvEqRel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Xi -&gt; EqRel
</span><a href="GHC.Core.Predicate.html#predTypeEqRel"><span class="hs-identifier hs-var">predTypeEqRel</span></a></span><span> </span><span class="annot"><span class="annottext">(Xi -&gt; EqRel) -&gt; (CtEvidence -&gt; Xi) -&gt; CtEvidence -&gt; EqRel
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#ctEvPred"><span class="hs-identifier hs-var">ctEvPred</span></a></span><span>
</span><span id="line-1418"></span><span>
</span><span id="line-1419"></span><span class="hs-comment">-- | Get the role relevant for a 'CtEvidence'</span><span>
</span><span id="line-1420"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvRole"><span class="hs-identifier hs-type">ctEvRole</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Axiom.html#Role"><span class="hs-identifier hs-type">Role</span></a></span><span>
</span><span id="line-1421"></span><span id="ctEvRole"><span class="annot"><span class="annottext">ctEvRole :: CtEvidence -&gt; Role
</span><a href="GHC.Tc.Types.Constraint.html#ctEvRole"><span class="hs-identifier hs-var hs-var">ctEvRole</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; Role
</span><a href="GHC.Core.Predicate.html#eqRelRole"><span class="hs-identifier hs-var">eqRelRole</span></a></span><span> </span><span class="annot"><span class="annottext">(EqRel -&gt; Role) -&gt; (CtEvidence -&gt; EqRel) -&gt; CtEvidence -&gt; Role
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; EqRel
</span><a href="GHC.Tc.Types.Constraint.html#ctEvEqRel"><span class="hs-identifier hs-var">ctEvEqRel</span></a></span><span>
</span><span id="line-1422"></span><span>
</span><span id="line-1423"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvTerm"><span class="hs-identifier hs-type">ctEvTerm</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#EvTerm"><span class="hs-identifier hs-type">EvTerm</span></a></span><span>
</span><span id="line-1424"></span><span id="ctEvTerm"><span class="annot"><span class="annottext">ctEvTerm :: CtEvidence -&gt; EvTerm
</span><a href="GHC.Tc.Types.Constraint.html#ctEvTerm"><span class="hs-identifier hs-var hs-var">ctEvTerm</span></a></span></span><span> </span><span id="local-6989586621680916544"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916544"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EvExpr -&gt; EvTerm
</span><a href="GHC.Tc.Types.Evidence.html#EvExpr"><span class="hs-identifier hs-var">EvExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; EvExpr
</span><a href="GHC.Tc.Types.Constraint.html#ctEvExpr"><span class="hs-identifier hs-var">ctEvExpr</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916544"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1425"></span><span>
</span><span id="line-1426"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvExpr"><span class="hs-identifier hs-type">ctEvExpr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#EvExpr"><span class="hs-identifier hs-type">EvExpr</span></a></span><span>
</span><span id="line-1427"></span><span id="ctEvExpr"><span class="annot"><span class="annottext">ctEvExpr :: CtEvidence -&gt; EvExpr
</span><a href="GHC.Tc.Types.Constraint.html#ctEvExpr"><span class="hs-identifier hs-var hs-var">ctEvExpr</span></a></span></span><span> </span><span id="local-6989586621680916542"><span class="annot"><span class="annottext">ev :: CtEvidence
</span><a href="#local-6989586621680916542"><span class="hs-identifier hs-var">ev</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtWanted"><span class="hs-identifier hs-type">CtWanted</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_dest :: CtEvidence -&gt; TcEvDest
</span><a href="GHC.Tc.Types.Constraint.html#ctev_dest"><span class="hs-identifier hs-var">ctev_dest</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#HoleDest"><span class="hs-identifier hs-type">HoleDest</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionHole
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1428"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Coercion -&gt; EvExpr
forall b. Coercion -&gt; Expr b
</span><a href="GHC.Core.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span> </span><span class="annot"><span class="annottext">(Coercion -&gt; EvExpr) -&gt; Coercion -&gt; EvExpr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; CtEvidence -&gt; Coercion
CtEvidence -&gt; Coercion
</span><a href="GHC.Tc.Types.Constraint.html#ctEvCoercion"><span class="hs-identifier hs-var">ctEvCoercion</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916542"><span class="hs-identifier hs-var">ev</span></a></span><span>
</span><span id="line-1429"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvExpr"><span class="hs-identifier hs-var">ctEvExpr</span></a></span><span> </span><span id="local-6989586621680916540"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916540"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EvVar -&gt; EvExpr
</span><a href="GHC.Tc.Types.Evidence.html#evId"><span class="hs-identifier hs-var">evId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; EvVar
</span><a href="GHC.Tc.Types.Constraint.html#ctEvEvId"><span class="hs-identifier hs-var">ctEvEvId</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916540"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1430"></span><span>
</span><span id="line-1431"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvCoercion"><span class="hs-identifier hs-type">ctEvCoercion</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#HasDebugCallStack"><span class="hs-identifier hs-type">HasDebugCallStack</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#TcCoercion"><span class="hs-identifier hs-type">TcCoercion</span></a></span><span>
</span><span id="line-1432"></span><span id="ctEvCoercion"><span class="annot"><span class="annottext">ctEvCoercion :: HasDebugCallStack =&gt; CtEvidence -&gt; Coercion
</span><a href="GHC.Tc.Types.Constraint.html#ctEvCoercion"><span class="hs-identifier hs-var hs-var">ctEvCoercion</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtGiven"><span class="hs-identifier hs-type">CtGiven</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_evar :: CtEvidence -&gt; EvVar
</span><a href="GHC.Tc.Types.Constraint.html#ctev_evar"><span class="hs-identifier hs-var">ctev_evar</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916533"><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916533"><span class="hs-identifier hs-var">ev_id</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1433"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EvVar -&gt; Coercion
</span><a href="GHC.Tc.Types.Evidence.html#mkTcCoVarCo"><span class="hs-identifier hs-var">mkTcCoVarCo</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916533"><span class="hs-identifier hs-var">ev_id</span></a></span><span>
</span><span id="line-1434"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvCoercion"><span class="hs-identifier hs-var">ctEvCoercion</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtWanted"><span class="hs-identifier hs-type">CtWanted</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_dest :: CtEvidence -&gt; TcEvDest
</span><a href="GHC.Tc.Types.Constraint.html#ctev_dest"><span class="hs-identifier hs-var">ctev_dest</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916531"><span class="annot"><span class="annottext">TcEvDest
</span><a href="#local-6989586621680916531"><span class="hs-identifier hs-var">dest</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1435"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#HoleDest"><span class="hs-identifier hs-type">HoleDest</span></a></span><span> </span><span id="local-6989586621680916530"><span class="annot"><span class="annottext">CoercionHole
</span><a href="#local-6989586621680916530"><span class="hs-identifier hs-var">hole</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcEvDest
</span><a href="#local-6989586621680916531"><span class="hs-identifier hs-var">dest</span></a></span><span>
</span><span id="line-1436"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- ctEvCoercion is only called on type equalities</span><span>
</span><span id="line-1437"></span><span>    </span><span class="hs-comment">-- and they always have HoleDests</span><span>
</span><span id="line-1438"></span><span>    </span><span class="annot"><span class="annottext">CoercionHole -&gt; Coercion
</span><a href="GHC.Core.Coercion.html#mkHoleCo"><span class="hs-identifier hs-var">mkHoleCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionHole
</span><a href="#local-6989586621680916530"><span class="hs-identifier hs-var">hole</span></a></span><span>
</span><span id="line-1439"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvCoercion"><span class="hs-identifier hs-var">ctEvCoercion</span></a></span><span> </span><span id="local-6989586621680916528"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916528"><span class="hs-identifier hs-var">ev</span></a></span></span><span>
</span><span id="line-1440"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Coercion
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ctEvCoercion&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916528"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1441"></span><span>
</span><span id="line-1442"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvEvId"><span class="hs-identifier hs-type">ctEvEvId</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span>
</span><span id="line-1443"></span><span id="ctEvEvId"><span class="annot"><span class="annottext">ctEvEvId :: CtEvidence -&gt; EvVar
</span><a href="GHC.Tc.Types.Constraint.html#ctEvEvId"><span class="hs-identifier hs-var hs-var">ctEvEvId</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtWanted"><span class="hs-identifier hs-type">CtWanted</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_dest :: CtEvidence -&gt; TcEvDest
</span><a href="GHC.Tc.Types.Constraint.html#ctev_dest"><span class="hs-identifier hs-var">ctev_dest</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#EvVarDest"><span class="hs-identifier hs-type">EvVarDest</span></a></span><span> </span><span id="local-6989586621680916526"><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916526"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916526"><span class="hs-identifier hs-var">ev</span></a></span><span>
</span><span id="line-1444"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvEvId"><span class="hs-identifier hs-var">ctEvEvId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtWanted"><span class="hs-identifier hs-type">CtWanted</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_dest :: CtEvidence -&gt; TcEvDest
</span><a href="GHC.Tc.Types.Constraint.html#ctev_dest"><span class="hs-identifier hs-var">ctev_dest</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#HoleDest"><span class="hs-identifier hs-type">HoleDest</span></a></span><span> </span><span id="local-6989586621680916525"><span class="annot"><span class="annottext">CoercionHole
</span><a href="#local-6989586621680916525"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoercionHole -&gt; EvVar
</span><a href="GHC.Core.TyCo.Rep.html#coHoleCoVar"><span class="hs-identifier hs-var">coHoleCoVar</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionHole
</span><a href="#local-6989586621680916525"><span class="hs-identifier hs-var">h</span></a></span><span>
</span><span id="line-1445"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvEvId"><span class="hs-identifier hs-var">ctEvEvId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtGiven"><span class="hs-identifier hs-type">CtGiven</span></a></span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_evar :: CtEvidence -&gt; EvVar
</span><a href="GHC.Tc.Types.Constraint.html#ctev_evar"><span class="hs-identifier hs-var">ctev_evar</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916523"><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916523"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916523"><span class="hs-identifier hs-var">ev</span></a></span><span>
</span><span id="line-1446"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvEvId"><span class="hs-identifier hs-var">ctEvEvId</span></a></span><span> </span><span id="local-6989586621680916522"><span class="annot"><span class="annottext">ctev :: CtEvidence
</span><a href="#local-6989586621680916522"><span class="hs-identifier hs-var">ctev</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtDerived"><span class="hs-identifier hs-type">CtDerived</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; EvVar
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ctEvId:&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916522"><span class="hs-identifier hs-var">ctev</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1447"></span><span>
</span><span id="line-1448"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680916519"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#TcEvDest"><span class="hs-identifier hs-type">TcEvDest</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1449"></span><span>  </span><span id="local-6989586621680916515"><span class="annot"><span class="annottext">ppr :: TcEvDest -&gt; SDoc
</span><a href="#local-6989586621680916515"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#HoleDest"><span class="hs-identifier hs-type">HoleDest</span></a></span><span> </span><span id="local-6989586621680916514"><span class="annot"><span class="annottext">CoercionHole
</span><a href="#local-6989586621680916514"><span class="hs-identifier hs-var">h</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;hole&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionHole -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionHole
</span><a href="#local-6989586621680916514"><span class="hs-identifier hs-var">h</span></a></span><span>
</span><span id="line-1450"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#EvVarDest"><span class="hs-identifier hs-type">EvVarDest</span></a></span><span> </span><span id="local-6989586621680916513"><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916513"><span class="hs-identifier hs-var">ev</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EvVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916513"><span class="hs-identifier hs-var">ev</span></a></span><span>
</span><span id="line-1451"></span><span>
</span><span id="line-1452"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680916510"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1453"></span><span>  </span><span id="local-6989586621680916505"><span class="annot"><span class="annottext">ppr :: CtEvidence -&gt; SDoc
</span><a href="#local-6989586621680916505"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span id="local-6989586621680916504"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916504"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtFlavour -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-var">ctEvFlavour</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916504"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1454"></span><span>           </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680916503"><span class="hs-identifier hs-var">pp_ev</span></a></span><span>
</span><span id="line-1455"></span><span>           </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SubGoalDepth -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtLoc -&gt; SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#ctl_depth"><span class="hs-identifier hs-var hs-var">ctl_depth</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#ctEvLoc"><span class="hs-identifier hs-var">ctEvLoc</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916504"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span>
</span><span id="line-1456"></span><span>                  </span><span class="hs-comment">-- Show the sub-goal depth too</span><span>
</span><span id="line-1457"></span><span>           </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Xi -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; Xi
</span><a href="GHC.Tc.Types.Constraint.html#ctEvPred"><span class="hs-identifier hs-var">ctEvPred</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916504"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1458"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-1459"></span><span>      </span><span id="local-6989586621680916503"><span class="annot"><span class="annottext">pp_ev :: SDoc
</span><a href="#local-6989586621680916503"><span class="hs-identifier hs-var hs-var">pp_ev</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916504"><span class="hs-identifier hs-var">ev</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1460"></span><span>             </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtGiven"><span class="hs-identifier hs-type">CtGiven</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_evar :: CtEvidence -&gt; EvVar
</span><a href="GHC.Tc.Types.Constraint.html#ctev_evar"><span class="hs-identifier hs-var">ctev_evar</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916499"><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916499"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">EvVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">EvVar
</span><a href="#local-6989586621680916499"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-1461"></span><span>             </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtWanted"><span class="hs-identifier hs-type">CtWanted</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">ctev_dest :: CtEvidence -&gt; TcEvDest
</span><a href="GHC.Tc.Types.Constraint.html#ctev_dest"><span class="hs-identifier hs-var">ctev_dest</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916498"><span class="annot"><span class="annottext">TcEvDest
</span><a href="#local-6989586621680916498"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcEvDest -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcEvDest
</span><a href="#local-6989586621680916498"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-1462"></span><span>             </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtDerived"><span class="hs-identifier hs-type">CtDerived</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;_&quot;</span></span><span>
</span><span id="line-1463"></span><span>
</span><span id="line-1464"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isWanted"><span class="hs-identifier hs-type">isWanted</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1465"></span><span id="isWanted"><span class="annot"><span class="annottext">isWanted :: CtEvidence -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isWanted"><span class="hs-identifier hs-var hs-var">isWanted</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtWanted"><span class="hs-identifier hs-type">CtWanted</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1466"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isWanted"><span class="hs-identifier hs-var">isWanted</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1467"></span><span>
</span><span id="line-1468"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isGiven"><span class="hs-identifier hs-type">isGiven</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1469"></span><span id="isGiven"><span class="annot"><span class="annottext">isGiven :: CtEvidence -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isGiven"><span class="hs-identifier hs-var hs-var">isGiven</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtGiven"><span class="hs-identifier hs-type">CtGiven</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1470"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isGiven"><span class="hs-identifier hs-var">isGiven</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1471"></span><span>
</span><span id="line-1472"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isDerived"><span class="hs-identifier hs-type">isDerived</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1473"></span><span id="isDerived"><span class="annot"><span class="annottext">isDerived :: CtEvidence -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isDerived"><span class="hs-identifier hs-var hs-var">isDerived</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtDerived"><span class="hs-identifier hs-type">CtDerived</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1474"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isDerived"><span class="hs-identifier hs-var">isDerived</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><span class="hs-identifier">_</span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1475"></span><span>
</span><span id="line-1476"></span><span class="hs-comment">{-
%************************************************************************
%*                                                                      *
            CtFlavour
%*                                                                      *
%************************************************************************

Note [Constraint flavours]
~~~~~~~~~~~~~~~~~~~~~~~~~~
Constraints come in four flavours:

* [G] Given: we have evidence

* [W] Wanted WOnly: we want evidence

* [D] Derived: any solution must satisfy this constraint, but
      we don't need evidence for it.  Examples include:
        - superclasses of [W] class constraints
        - equalities arising from functional dependencies
          or injectivity

* [WD] Wanted WDeriv: a single constraint that represents
                      both [W] and [D]
  We keep them paired as one both for efficiency, and because
  when we have a finite map  F tys -&gt; CFunEqCan, it's inconvenient
  to have two CFunEqCans in the range

The ctev_nosh field of a Wanted distinguishes between [W] and [WD]

Wanted constraints are born as [WD], but are split into [W] and its
&quot;shadow&quot; [D] in GHC.Tc.Solver.Monad.maybeEmitShadow.

See Note [The improvement story and derived shadows] in GHC.Tc.Solver.Monad
-}</span><span>
</span><span id="line-1510"></span><span>
</span><span id="line-1511"></span><span class="hs-keyword">data</span><span> </span><span id="CtFlavour"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavour"><span class="hs-identifier hs-var">CtFlavour</span></a></span></span><span>  </span><span class="hs-comment">-- See Note [Constraint flavours]</span><span>
</span><span id="line-1512"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="Given"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Given"><span class="hs-identifier hs-var">Given</span></a></span></span><span>
</span><span id="line-1513"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Wanted"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-var">Wanted</span></a></span></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ShadowInfo"><span class="hs-identifier hs-type">ShadowInfo</span></a></span><span>
</span><span id="line-1514"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Derived"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span></span><span>
</span><span id="line-1515"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span id="local-6989586621680916491"><span id="local-6989586621680916494"><span class="annot"><span class="annottext">CtFlavour -&gt; CtFlavour -&gt; Bool
(CtFlavour -&gt; CtFlavour -&gt; Bool)
-&gt; (CtFlavour -&gt; CtFlavour -&gt; Bool) -&gt; Eq CtFlavour
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: CtFlavour -&gt; CtFlavour -&gt; Bool
$c/= :: CtFlavour -&gt; CtFlavour -&gt; Bool
== :: CtFlavour -&gt; CtFlavour -&gt; Bool
$c== :: CtFlavour -&gt; CtFlavour -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span>
</span><span id="line-1516"></span><span>
</span><span id="line-1517"></span><span class="hs-keyword">data</span><span> </span><span id="ShadowInfo"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ShadowInfo"><span class="hs-identifier hs-var">ShadowInfo</span></a></span></span><span>
</span><span id="line-1518"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="WDeriv"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WDeriv"><span class="hs-identifier hs-var">WDeriv</span></a></span></span><span>   </span><span class="hs-comment">-- [WD] This Wanted constraint has no Derived shadow,</span><span>
</span><span id="line-1519"></span><span>             </span><span class="hs-comment">-- so it behaves like a pair of a Wanted and a Derived</span><span>
</span><span id="line-1520"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="WOnly"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#WOnly"><span class="hs-identifier hs-var">WOnly</span></a></span></span><span>    </span><span class="hs-comment">-- [W] It has a separate derived shadow</span><span>
</span><span id="line-1521"></span><span>             </span><span class="hs-comment">-- See Note [The improvement story and derived shadows] in GHC.Tc.Solver.Monad</span><span>
</span><span id="line-1522"></span><span>  </span><span class="hs-keyword">deriving</span><span class="hs-special">(</span><span> </span><span id="local-6989586621680916486"><span id="local-6989586621680916488"><span class="annot"><span class="annottext">ShadowInfo -&gt; ShadowInfo -&gt; Bool
(ShadowInfo -&gt; ShadowInfo -&gt; Bool)
-&gt; (ShadowInfo -&gt; ShadowInfo -&gt; Bool) -&gt; Eq ShadowInfo
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: ShadowInfo -&gt; ShadowInfo -&gt; Bool
$c/= :: ShadowInfo -&gt; ShadowInfo -&gt; Bool
== :: ShadowInfo -&gt; ShadowInfo -&gt; Bool
$c== :: ShadowInfo -&gt; ShadowInfo -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1523"></span><span>
</span><span id="line-1524"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isGivenOrWDeriv"><span class="hs-identifier hs-type">isGivenOrWDeriv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavour"><span class="hs-identifier hs-type">CtFlavour</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1525"></span><span id="isGivenOrWDeriv"><span class="annot"><span class="annottext">isGivenOrWDeriv :: CtFlavour -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#isGivenOrWDeriv"><span class="hs-identifier hs-var hs-var">isGivenOrWDeriv</span></a></span></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Given"><span class="hs-identifier hs-var">Given</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1526"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isGivenOrWDeriv"><span class="hs-identifier hs-var">isGivenOrWDeriv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WDeriv"><span class="hs-identifier hs-var">WDeriv</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1527"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#isGivenOrWDeriv"><span class="hs-identifier hs-var">isGivenOrWDeriv</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1528"></span><span>
</span><span id="line-1529"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680916483"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavour"><span class="hs-identifier hs-type">CtFlavour</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1530"></span><span>  </span><span id="local-6989586621680916482"><span class="annot"><span class="annottext">ppr :: CtFlavour -&gt; SDoc
</span><a href="#local-6989586621680916482"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Given"><span class="hs-identifier hs-var">Given</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;[G]&quot;</span></span><span>
</span><span id="line-1531"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WDeriv"><span class="hs-identifier hs-var">WDeriv</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;[WD]&quot;</span></span><span>
</span><span id="line-1532"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WOnly"><span class="hs-identifier hs-var">WOnly</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;[W]&quot;</span></span><span>
</span><span id="line-1533"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;[D]&quot;</span></span><span>
</span><span id="line-1534"></span><span>
</span><span id="line-1535"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-type">ctEvFlavour</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavour"><span class="hs-identifier hs-type">CtFlavour</span></a></span><span>
</span><span id="line-1536"></span><span id="ctEvFlavour"><span class="annot"><span class="annottext">ctEvFlavour :: CtEvidence -&gt; CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-var hs-var">ctEvFlavour</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtWanted"><span class="hs-identifier hs-type">CtWanted</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctev_nosh :: CtEvidence -&gt; ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#ctev_nosh"><span class="hs-identifier hs-var">ctev_nosh</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916481"><span class="annot"><span class="annottext">ShadowInfo
</span><a href="#local-6989586621680916481"><span class="hs-identifier hs-var">nosh</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShadowInfo -&gt; CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-var">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="#local-6989586621680916481"><span class="hs-identifier hs-var">nosh</span></a></span><span>
</span><span id="line-1537"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-var">ctEvFlavour</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtGiven"><span class="hs-identifier hs-type">CtGiven</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Given"><span class="hs-identifier hs-var">Given</span></a></span><span>
</span><span id="line-1538"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-var">ctEvFlavour</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtDerived"><span class="hs-identifier hs-type">CtDerived</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span>
</span><span id="line-1539"></span><span>
</span><span id="line-1540"></span><span class="hs-comment">-- | Whether or not one 'Ct' can rewrite another is determined by its</span><span>
</span><span id="line-1541"></span><span class="hs-comment">-- flavour and its equality relation. See also</span><span>
</span><span id="line-1542"></span><span class="hs-comment">-- Note [Flavours with roles] in &quot;GHC.Tc.Solver.Monad&quot;</span><span>
</span><span id="line-1543"></span><span class="hs-keyword">type</span><span> </span><span id="CtFlavourRole"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavourRole"><span class="hs-identifier hs-var">CtFlavourRole</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavour"><span class="hs-identifier hs-type">CtFlavour</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1544"></span><span>
</span><span id="line-1545"></span><span class="hs-comment">-- | Extract the flavour, role, and boxity from a 'CtEvidence'</span><span>
</span><span id="line-1546"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctEvFlavourRole"><span class="hs-identifier hs-type">ctEvFlavourRole</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavourRole"><span class="hs-identifier hs-type">CtFlavourRole</span></a></span><span>
</span><span id="line-1547"></span><span id="ctEvFlavourRole"><span class="annot"><span class="annottext">ctEvFlavourRole :: CtEvidence -&gt; CtFlavourRole
</span><a href="GHC.Tc.Types.Constraint.html#ctEvFlavourRole"><span class="hs-identifier hs-var hs-var">ctEvFlavourRole</span></a></span></span><span> </span><span id="local-6989586621680916480"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916480"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-var">ctEvFlavour</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916480"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; EqRel
</span><a href="GHC.Tc.Types.Constraint.html#ctEvEqRel"><span class="hs-identifier hs-var">ctEvEqRel</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916480"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1548"></span><span>
</span><span id="line-1549"></span><span class="hs-comment">-- | Extract the flavour and role from a 'Ct'</span><span>
</span><span id="line-1550"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctFlavourRole"><span class="hs-identifier hs-type">ctFlavourRole</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Ct"><span class="hs-identifier hs-type">Ct</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavourRole"><span class="hs-identifier hs-type">CtFlavourRole</span></a></span><span>
</span><span id="line-1551"></span><span class="hs-comment">-- Uses short-cuts to role for special cases</span><span>
</span><span id="line-1552"></span><span id="ctFlavourRole"><span class="annot"><span class="annottext">ctFlavourRole :: Ct -&gt; CtFlavourRole
</span><a href="GHC.Tc.Types.Constraint.html#ctFlavourRole"><span class="hs-identifier hs-var hs-var">ctFlavourRole</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CDictCan"><span class="hs-identifier hs-type">CDictCan</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_ev :: Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var">cc_ev</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916479"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916479"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1553"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-var">ctEvFlavour</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916479"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1554"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctFlavourRole"><span class="hs-identifier hs-var">ctFlavourRole</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CTyEqCan"><span class="hs-identifier hs-type">CTyEqCan</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_ev :: Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var">cc_ev</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916478"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916478"><span class="hs-identifier hs-var">ev</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cc_eq_rel :: Ct -&gt; EqRel
</span><a href="GHC.Tc.Types.Constraint.html#cc_eq_rel"><span class="hs-identifier hs-var">cc_eq_rel</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916477"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680916477"><span class="hs-identifier hs-var">eq_rel</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1555"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-var">ctEvFlavour</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916478"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680916477"><span class="hs-identifier hs-var">eq_rel</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1556"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctFlavourRole"><span class="hs-identifier hs-var">ctFlavourRole</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CFunEqCan"><span class="hs-identifier hs-type">CFunEqCan</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cc_ev :: Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#cc_ev"><span class="hs-identifier hs-var">cc_ev</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916476"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916476"><span class="hs-identifier hs-var">ev</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1557"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-var">ctEvFlavour</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916476"><span class="hs-identifier hs-var">ev</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1558"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctFlavourRole"><span class="hs-identifier hs-var">ctFlavourRole</span></a></span><span> </span><span id="local-6989586621680916475"><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916475"><span class="hs-identifier hs-var">ct</span></a></span></span><span>
</span><span id="line-1559"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtEvidence -&gt; CtFlavourRole
</span><a href="GHC.Tc.Types.Constraint.html#ctEvFlavourRole"><span class="hs-identifier hs-var">ctEvFlavourRole</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ct -&gt; CtEvidence
</span><a href="GHC.Tc.Types.Constraint.html#ctEvidence"><span class="hs-identifier hs-var">ctEvidence</span></a></span><span> </span><span class="annot"><span class="annottext">Ct
</span><a href="#local-6989586621680916475"><span class="hs-identifier hs-var">ct</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1560"></span><span>
</span><span id="line-1561"></span><span class="hs-comment">{- Note [eqCanRewrite]
~~~~~~~~~~~~~~~~~~~~~~
(eqCanRewrite ct1 ct2) holds if the constraint ct1 (a CTyEqCan of form
tv ~ ty) can be used to rewrite ct2.  It must satisfy the properties of
a can-rewrite relation, see Definition [Can-rewrite relation] in
GHC.Tc.Solver.Monad.

With the solver handling Coercible constraints like equality constraints,
the rewrite conditions must take role into account, never allowing
a representational equality to rewrite a nominal one.

Note [Wanteds do not rewrite Wanteds]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We don't allow Wanteds to rewrite Wanteds, because that can give rise
to very confusing type error messages.  A good example is #8450.
Here's another
   f :: a -&gt; Bool
   f x = ( [x,'c'], [x,True] ) `seq` True
Here we get
  [W] a ~ Char
  [W] a ~ Bool
but we do not want to complain about Bool ~ Char!

Note [Deriveds do rewrite Deriveds]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
However we DO allow Deriveds to rewrite Deriveds, because that's how
improvement works; see Note [The improvement story] in GHC.Tc.Solver.Interact.

However, for now at least I'm only letting (Derived,NomEq) rewrite
(Derived,NomEq) and not doing anything for ReprEq.  If we have
    eqCanRewriteFR (Derived, NomEq) (Derived, _)  = True
then we lose property R2 of Definition [Can-rewrite relation]
in GHC.Tc.Solver.Monad
  R2.  If f1 &gt;= f, and f2 &gt;= f,
       then either f1 &gt;= f2 or f2 &gt;= f1
Consider f1 = (Given, ReprEq)
         f2 = (Derived, NomEq)
          f = (Derived, ReprEq)

I thought maybe we could never get Derived ReprEq constraints, but
we can; straight from the Wanteds during improvement. And from a Derived
ReprEq we could conceivably get a Derived NomEq improvement (by decomposing
a type constructor with Nomninal role), and hence unify.
-}</span><span>
</span><span id="line-1605"></span><span>
</span><span id="line-1606"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanRewrite"><span class="hs-identifier hs-type">eqCanRewrite</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1607"></span><span id="eqCanRewrite"><span class="annot"><span class="annottext">eqCanRewrite :: EqRel -&gt; EqRel -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#eqCanRewrite"><span class="hs-identifier hs-var hs-var">eqCanRewrite</span></a></span></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span>  </span><span class="annot"><span class="annottext">EqRel
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1608"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanRewrite"><span class="hs-identifier hs-var">eqCanRewrite</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1609"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanRewrite"><span class="hs-identifier hs-var">eqCanRewrite</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1610"></span><span>
</span><span id="line-1611"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanRewriteFR"><span class="hs-identifier hs-type">eqCanRewriteFR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavourRole"><span class="hs-identifier hs-type">CtFlavourRole</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavourRole"><span class="hs-identifier hs-type">CtFlavourRole</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1612"></span><span class="hs-comment">-- Can fr1 actually rewrite fr2?</span><span>
</span><span id="line-1613"></span><span class="hs-comment">-- Very important function!</span><span>
</span><span id="line-1614"></span><span class="hs-comment">-- See Note [eqCanRewrite]</span><span>
</span><span id="line-1615"></span><span class="hs-comment">-- See Note [Wanteds do not rewrite Wanteds]</span><span>
</span><span id="line-1616"></span><span class="hs-comment">-- See Note [Deriveds do rewrite Deriveds]</span><span>
</span><span id="line-1617"></span><span id="eqCanRewriteFR"><span class="annot"><span class="annottext">eqCanRewriteFR :: CtFlavourRole -&gt; CtFlavourRole -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#eqCanRewriteFR"><span class="hs-identifier hs-var hs-var">eqCanRewriteFR</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Given"><span class="hs-identifier hs-var">Given</span></a></span><span class="hs-special">,</span><span>         </span><span id="local-6989586621680916474"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680916474"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtFlavour
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span>       </span><span id="local-6989586621680916473"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680916473"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; EqRel -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#eqCanRewrite"><span class="hs-identifier hs-var">eqCanRewrite</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680916474"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680916473"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-1618"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanRewriteFR"><span class="hs-identifier hs-var">eqCanRewriteFR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WDeriv"><span class="hs-identifier hs-var">WDeriv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1619"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanRewriteFR"><span class="hs-identifier hs-var">eqCanRewriteFR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span class="hs-special">,</span><span>       </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1620"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanRewriteFR"><span class="hs-identifier hs-var">eqCanRewriteFR</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavourRole
</span><span class="hs-identifier">_</span></span><span>                      </span><span class="annot"><span class="annottext">CtFlavourRole
</span><span class="hs-identifier">_</span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1621"></span><span>
</span><span id="line-1622"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqMayRewriteFR"><span class="hs-identifier hs-type">eqMayRewriteFR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavourRole"><span class="hs-identifier hs-type">CtFlavourRole</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavourRole"><span class="hs-identifier hs-type">CtFlavourRole</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1623"></span><span class="hs-comment">-- Is it /possible/ that fr1 can rewrite fr2?</span><span>
</span><span id="line-1624"></span><span class="hs-comment">-- This is used when deciding which inerts to kick out,</span><span>
</span><span id="line-1625"></span><span class="hs-comment">-- at which time a [WD] inert may be split into [W] and [D]</span><span>
</span><span id="line-1626"></span><span id="eqMayRewriteFR"><span class="annot"><span class="annottext">eqMayRewriteFR :: CtFlavourRole -&gt; CtFlavourRole -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#eqMayRewriteFR"><span class="hs-identifier hs-var hs-var">eqMayRewriteFR</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WDeriv"><span class="hs-identifier hs-var">WDeriv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WDeriv"><span class="hs-identifier hs-var">WDeriv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1627"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqMayRewriteFR"><span class="hs-identifier hs-var">eqMayRewriteFR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span class="hs-special">,</span><span>       </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WDeriv"><span class="hs-identifier hs-var">WDeriv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1628"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqMayRewriteFR"><span class="hs-identifier hs-var">eqMayRewriteFR</span></a></span><span> </span><span id="local-6989586621680916472"><span class="annot"><span class="annottext">CtFlavourRole
</span><a href="#local-6989586621680916472"><span class="hs-identifier hs-var">fr1</span></a></span></span><span> </span><span id="local-6989586621680916471"><span class="annot"><span class="annottext">CtFlavourRole
</span><a href="#local-6989586621680916471"><span class="hs-identifier hs-var">fr2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtFlavourRole -&gt; CtFlavourRole -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#eqCanRewriteFR"><span class="hs-identifier hs-var">eqCanRewriteFR</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavourRole
</span><a href="#local-6989586621680916472"><span class="hs-identifier hs-var">fr1</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavourRole
</span><a href="#local-6989586621680916471"><span class="hs-identifier hs-var">fr2</span></a></span><span>
</span><span id="line-1629"></span><span>
</span><span id="line-1630"></span><span class="hs-comment">-----------------</span><span>
</span><span id="line-1631"></span><span class="hs-comment">{- Note [funEqCanDischarge]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppose we have two CFunEqCans with the same LHS:
    (x1:F ts ~ f1) `funEqCanDischarge` (x2:F ts ~ f2)
Can we drop x2 in favour of x1, either unifying
f2 (if it's a flatten meta-var) or adding a new Given
(f1 ~ f2), if x2 is a Given?

Answer: yes if funEqCanDischarge is true.
-}</span><span>
</span><span id="line-1641"></span><span>
</span><span id="line-1642"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#funEqCanDischarge"><span class="hs-identifier hs-type">funEqCanDischarge</span></a></span><span>
</span><span id="line-1643"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtEvidence"><span class="hs-identifier hs-type">CtEvidence</span></a></span><span>
</span><span id="line-1644"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#SwapFlag"><span class="hs-identifier hs-type">SwapFlag</span></a></span><span>   </span><span class="hs-comment">-- NotSwapped =&gt; lhs can discharge rhs</span><span>
</span><span id="line-1645"></span><span>                  </span><span class="hs-comment">-- Swapped    =&gt; rhs can discharge lhs</span><span>
</span><span id="line-1646"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span>      </span><span class="hs-comment">-- True &lt;=&gt; upgrade non-discharded one</span><span>
</span><span id="line-1647"></span><span>                  </span><span class="hs-comment">--          from [W] to [WD]</span><span>
</span><span id="line-1648"></span><span class="hs-comment">-- See Note [funEqCanDischarge]</span><span>
</span><span id="line-1649"></span><span id="funEqCanDischarge"><span class="annot"><span class="annottext">funEqCanDischarge :: CtEvidence -&gt; CtEvidence -&gt; (SwapFlag, Bool)
</span><a href="GHC.Tc.Types.Constraint.html#funEqCanDischarge"><span class="hs-identifier hs-var hs-var">funEqCanDischarge</span></a></span></span><span> </span><span id="local-6989586621680916470"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916470"><span class="hs-identifier hs-var">ev1</span></a></span></span><span> </span><span id="local-6989586621680916469"><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916469"><span class="hs-identifier hs-var">ev2</span></a></span></span><span>
</span><span id="line-1650"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">ctEvEqRel</span><span> </span><span class="hs-identifier">ev1</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">NomEq</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">ev1</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1651"></span><span>    </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">ctEvEqRel</span><span> </span><span class="hs-identifier">ev2</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">NomEq</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">ev2</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1652"></span><span>    </span><span class="hs-comment">-- CFunEqCans are all Nominal, hence asserts</span><span>
</span><span id="line-1653"></span><span>    </span><span class="annot"><span class="annottext">CtFlavour -&gt; CtFlavour -&gt; (SwapFlag, Bool)
</span><a href="GHC.Tc.Types.Constraint.html#funEqCanDischargeF"><span class="hs-identifier hs-var">funEqCanDischargeF</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-var">ctEvFlavour</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916470"><span class="hs-identifier hs-var">ev1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtEvidence -&gt; CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#ctEvFlavour"><span class="hs-identifier hs-var">ctEvFlavour</span></a></span><span> </span><span class="annot"><span class="annottext">CtEvidence
</span><a href="#local-6989586621680916469"><span class="hs-identifier hs-var">ev2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1654"></span><span>
</span><span id="line-1655"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#funEqCanDischargeF"><span class="hs-identifier hs-type">funEqCanDischargeF</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavour"><span class="hs-identifier hs-type">CtFlavour</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavour"><span class="hs-identifier hs-type">CtFlavour</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#SwapFlag"><span class="hs-identifier hs-type">SwapFlag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span>
</span><span id="line-1656"></span><span id="funEqCanDischargeF"><span class="annot"><span class="annottext">funEqCanDischargeF :: CtFlavour -&gt; CtFlavour -&gt; (SwapFlag, Bool)
</span><a href="GHC.Tc.Types.Constraint.html#funEqCanDischargeF"><span class="hs-identifier hs-var hs-var">funEqCanDischargeF</span></a></span></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Given"><span class="hs-identifier hs-var">Given</span></a></span><span>           </span><span class="annot"><span class="annottext">CtFlavour
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SwapFlag
</span><a href="GHC.Types.Basic.html#NotSwapped"><span class="hs-identifier hs-var">NotSwapped</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span>
</span><span id="line-1657"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#funEqCanDischargeF"><span class="hs-identifier hs-var">funEqCanDischargeF</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><span class="hs-identifier">_</span></span><span>               </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Given"><span class="hs-identifier hs-var">Given</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SwapFlag
</span><a href="GHC.Types.Basic.html#IsSwapped"><span class="hs-identifier hs-var">IsSwapped</span></a></span><span class="hs-special">,</span><span>  </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span>
</span><span id="line-1658"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#funEqCanDischargeF"><span class="hs-identifier hs-var">funEqCanDischargeF</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WDeriv"><span class="hs-identifier hs-var">WDeriv</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SwapFlag
</span><a href="GHC.Types.Basic.html#NotSwapped"><span class="hs-identifier hs-var">NotSwapped</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span>
</span><span id="line-1659"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#funEqCanDischargeF"><span class="hs-identifier hs-var">funEqCanDischargeF</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WDeriv"><span class="hs-identifier hs-var">WDeriv</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SwapFlag
</span><a href="GHC.Types.Basic.html#IsSwapped"><span class="hs-identifier hs-var">IsSwapped</span></a></span><span class="hs-special">,</span><span>  </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>
</span><span id="line-1660"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#funEqCanDischargeF"><span class="hs-identifier hs-var">funEqCanDischargeF</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WOnly"><span class="hs-identifier hs-var">WOnly</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WOnly"><span class="hs-identifier hs-var">WOnly</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SwapFlag
</span><a href="GHC.Types.Basic.html#NotSwapped"><span class="hs-identifier hs-var">NotSwapped</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span>
</span><span id="line-1661"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#funEqCanDischargeF"><span class="hs-identifier hs-var">funEqCanDischargeF</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WOnly"><span class="hs-identifier hs-var">WOnly</span></a></span><span class="hs-special">)</span><span>  </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SwapFlag
</span><a href="GHC.Types.Basic.html#NotSwapped"><span class="hs-identifier hs-var">NotSwapped</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>
</span><span id="line-1662"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#funEqCanDischargeF"><span class="hs-identifier hs-var">funEqCanDischargeF</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span>         </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WOnly"><span class="hs-identifier hs-var">WOnly</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SwapFlag
</span><a href="GHC.Types.Basic.html#IsSwapped"><span class="hs-identifier hs-var">IsSwapped</span></a></span><span class="hs-special">,</span><span>  </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>
</span><span id="line-1663"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#funEqCanDischargeF"><span class="hs-identifier hs-var">funEqCanDischargeF</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span>         </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SwapFlag
</span><a href="GHC.Types.Basic.html#NotSwapped"><span class="hs-identifier hs-var">NotSwapped</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span>
</span><span id="line-1664"></span><span>
</span><span id="line-1665"></span><span>
</span><span id="line-1666"></span><span class="hs-comment">{- Note [eqCanDischarge]
~~~~~~~~~~~~~~~~~~~~~~~~
Suppose we have two identical CTyEqCan equality constraints
(i.e. both LHS and RHS are the same)
      (x1:a~t) `eqCanDischarge` (xs:a~t)
Can we just drop x2 in favour of x1?

Answer: yes if eqCanDischarge is true.

Note that we do /not/ allow Wanted to discharge Derived.
We must keep both.  Why?  Because the Derived may rewrite
other Deriveds in the model whereas the Wanted cannot.

However a Wanted can certainly discharge an identical Wanted.  So
eqCanDischarge does /not/ define a can-rewrite relation in the
sense of Definition [Can-rewrite relation] in GHC.Tc.Solver.Monad.

We /do/ say that a [W] can discharge a [WD].  In evidence terms it
certainly can, and the /caller/ arranges that the otherwise-lost [D]
is spat out as a new Derived.  -}</span><span>
</span><span id="line-1686"></span><span>
</span><span id="line-1687"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanDischargeFR"><span class="hs-identifier hs-type">eqCanDischargeFR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavourRole"><span class="hs-identifier hs-type">CtFlavourRole</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavourRole"><span class="hs-identifier hs-type">CtFlavourRole</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1688"></span><span class="hs-comment">-- See Note [eqCanDischarge]</span><span>
</span><span id="line-1689"></span><span id="eqCanDischargeFR"><span class="annot"><span class="annottext">eqCanDischargeFR :: CtFlavourRole -&gt; CtFlavourRole -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#eqCanDischargeFR"><span class="hs-identifier hs-var hs-var">eqCanDischargeFR</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680916464"><span class="annot"><span class="annottext">CtFlavour
</span><a href="#local-6989586621680916464"><span class="hs-identifier hs-var">f1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680916463"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680916463"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680916462"><span class="annot"><span class="annottext">CtFlavour
</span><a href="#local-6989586621680916462"><span class="hs-identifier hs-var">f2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680916461"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680916461"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">EqRel -&gt; EqRel -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#eqCanRewrite"><span class="hs-identifier hs-var">eqCanRewrite</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680916463"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680916461"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-1690"></span><span>                                  </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">CtFlavour -&gt; CtFlavour -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#eqCanDischargeF"><span class="hs-identifier hs-var">eqCanDischargeF</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="#local-6989586621680916464"><span class="hs-identifier hs-var">f1</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="#local-6989586621680916462"><span class="hs-identifier hs-var">f2</span></a></span><span>
</span><span id="line-1691"></span><span>
</span><span id="line-1692"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanDischargeF"><span class="hs-identifier hs-type">eqCanDischargeF</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavour"><span class="hs-identifier hs-type">CtFlavour</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtFlavour"><span class="hs-identifier hs-type">CtFlavour</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1693"></span><span id="eqCanDischargeF"><span class="annot"><span class="annottext">eqCanDischargeF :: CtFlavour -&gt; CtFlavour -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#eqCanDischargeF"><span class="hs-identifier hs-var hs-var">eqCanDischargeF</span></a></span></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Given"><span class="hs-identifier hs-var">Given</span></a></span><span>   </span><span class="annot"><span class="annottext">CtFlavour
</span><span class="hs-identifier">_</span></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1694"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanDischargeF"><span class="hs-identifier hs-var">eqCanDischargeF</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>      </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1695"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanDischargeF"><span class="hs-identifier hs-var">eqCanDischargeF</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#Wanted"><span class="hs-identifier hs-type">Wanted</span></a></span><span> </span><span class="annot"><span class="annottext">ShadowInfo
</span><a href="GHC.Tc.Types.Constraint.html#WDeriv"><span class="hs-identifier hs-var">WDeriv</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1696"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanDischargeF"><span class="hs-identifier hs-var">eqCanDischargeF</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span>         </span><span class="annot"><span class="annottext">CtFlavour
</span><a href="GHC.Tc.Types.Constraint.html#Derived"><span class="hs-identifier hs-var">Derived</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1697"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#eqCanDischargeF"><span class="hs-identifier hs-var">eqCanDischargeF</span></a></span><span> </span><span class="annot"><span class="annottext">CtFlavour
</span><span class="hs-identifier">_</span></span><span>               </span><span class="annot"><span class="annottext">CtFlavour
</span><span class="hs-identifier">_</span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1698"></span><span>
</span><span id="line-1699"></span><span>
</span><span id="line-1700"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
            SubGoalDepth
*                                                                      *
************************************************************************

Note [SubGoalDepth]
~~~~~~~~~~~~~~~~~~~
The 'SubGoalDepth' takes care of stopping the constraint solver from looping.

The counter starts at zero and increases. It includes dictionary constraints,
equality simplification, and type family reduction. (Why combine these? Because
it's actually quite easy to mistake one for another, in sufficiently involved
scenarios, like ConstraintKinds.)

The flag -freduction-depth=n fixes the maximium level.

* The counter includes the depth of type class instance declarations.  Example:
     [W] d{7} : Eq [Int]
  That is d's dictionary-constraint depth is 7.  If we use the instance
     $dfEqList :: Eq a =&gt; Eq [a]
  to simplify it, we get
     d{7} = $dfEqList d'{8}
  where d'{8} : Eq Int, and d' has depth 8.

  For civilised (decidable) instance declarations, each increase of
  depth removes a type constructor from the type, so the depth never
  gets big; i.e. is bounded by the structural depth of the type.

* The counter also increments when resolving
equalities involving type functions. Example:
  Assume we have a wanted at depth 7:
    [W] d{7} : F () ~ a
  If there is a type function equation &quot;F () = Int&quot;, this would be rewritten to
    [W] d{8} : Int ~ a
  and remembered as having depth 8.

  Again, without UndecidableInstances, this counter is bounded, but without it
  can resolve things ad infinitum. Hence there is a maximum level.

* Lastly, every time an equality is rewritten, the counter increases. Again,
  rewriting an equality constraint normally makes progress, but it's possible
  the &quot;progress&quot; is just the reduction of an infinitely-reducing type family.
  Hence we need to track the rewrites.

When compiling a program requires a greater depth, then GHC recommends turning
off this check entirely by setting -freduction-depth=0. This is because the
exact number that works is highly variable, and is likely to change even between
minor releases. Because this check is solely to prevent infinite compilation
times, it seems safe to disable it when a user has ascertained that their program
doesn't loop at the type level.

-}</span><span>
</span><span id="line-1754"></span><span>
</span><span id="line-1755"></span><span class="hs-comment">-- | See Note [SubGoalDepth]</span><span>
</span><span id="line-1756"></span><span class="hs-keyword">newtype</span><span> </span><span id="SubGoalDepth"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-var">SubGoalDepth</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="SubGoalDepth"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-var">SubGoalDepth</span></a></span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-1757"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680916452"><span id="local-6989586621680916457"><span class="annot"><span class="annottext">SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
(SubGoalDepth -&gt; SubGoalDepth -&gt; Bool)
-&gt; (SubGoalDepth -&gt; SubGoalDepth -&gt; Bool) -&gt; Eq SubGoalDepth
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
$c/= :: SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
== :: SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
$c== :: SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680916421"><span id="local-6989586621680916425"><span id="local-6989586621680916429"><span id="local-6989586621680916433"><span id="local-6989586621680916437"><span id="local-6989586621680916441"><span id="local-6989586621680916445"><span class="annot"><span class="annottext">Eq SubGoalDepth
Eq SubGoalDepth
-&gt; (SubGoalDepth -&gt; SubGoalDepth -&gt; Ordering)
-&gt; (SubGoalDepth -&gt; SubGoalDepth -&gt; Bool)
-&gt; (SubGoalDepth -&gt; SubGoalDepth -&gt; Bool)
-&gt; (SubGoalDepth -&gt; SubGoalDepth -&gt; Bool)
-&gt; (SubGoalDepth -&gt; SubGoalDepth -&gt; Bool)
-&gt; (SubGoalDepth -&gt; SubGoalDepth -&gt; SubGoalDepth)
-&gt; (SubGoalDepth -&gt; SubGoalDepth -&gt; SubGoalDepth)
-&gt; Ord SubGoalDepth
SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
SubGoalDepth -&gt; SubGoalDepth -&gt; Ordering
SubGoalDepth -&gt; SubGoalDepth -&gt; SubGoalDepth
forall a.
Eq a
-&gt; (a -&gt; a -&gt; Ordering)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; Ord a
min :: SubGoalDepth -&gt; SubGoalDepth -&gt; SubGoalDepth
$cmin :: SubGoalDepth -&gt; SubGoalDepth -&gt; SubGoalDepth
max :: SubGoalDepth -&gt; SubGoalDepth -&gt; SubGoalDepth
$cmax :: SubGoalDepth -&gt; SubGoalDepth -&gt; SubGoalDepth
&gt;= :: SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
$c&gt;= :: SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
&gt; :: SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
$c&gt; :: SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
&lt;= :: SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
$c&lt;= :: SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
&lt; :: SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
$c&lt; :: SubGoalDepth -&gt; SubGoalDepth -&gt; Bool
compare :: SubGoalDepth -&gt; SubGoalDepth -&gt; Ordering
$ccompare :: SubGoalDepth -&gt; SubGoalDepth -&gt; Ordering
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Ord</span></span></span></span></span></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680916410"><span id="local-6989586621680916415"><span class="annot"><span class="annottext">Rational -&gt; SubGoalDepth -&gt; SDoc
SubGoalDepth -&gt; SDoc
(SubGoalDepth -&gt; SDoc)
-&gt; (Rational -&gt; SubGoalDepth -&gt; SDoc) -&gt; Outputable SubGoalDepth
forall a. (a -&gt; SDoc) -&gt; (Rational -&gt; a -&gt; SDoc) -&gt; Outputable a
pprPrec :: Rational -&gt; SubGoalDepth -&gt; SDoc
$cpprPrec :: Rational -&gt; SubGoalDepth -&gt; SDoc
ppr :: SubGoalDepth -&gt; SDoc
$cppr :: SubGoalDepth -&gt; SDoc
</span><a href="#local-6989586621680916410"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Outputable</span></a></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-1758"></span><span>
</span><span id="line-1759"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#initialSubGoalDepth"><span class="hs-identifier hs-type">initialSubGoalDepth</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span>
</span><span id="line-1760"></span><span id="initialSubGoalDepth"><span class="annot"><span class="annottext">initialSubGoalDepth :: SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#initialSubGoalDepth"><span class="hs-identifier hs-var hs-var">initialSubGoalDepth</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-var">SubGoalDepth</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1761"></span><span>
</span><span id="line-1762"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#bumpSubGoalDepth"><span class="hs-identifier hs-type">bumpSubGoalDepth</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span>
</span><span id="line-1763"></span><span id="bumpSubGoalDepth"><span class="annot"><span class="annottext">bumpSubGoalDepth :: SubGoalDepth -&gt; SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#bumpSubGoalDepth"><span class="hs-identifier hs-var hs-var">bumpSubGoalDepth</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span> </span><span id="local-6989586621680916407"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680916407"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-var">SubGoalDepth</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680916407"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-1764"></span><span>
</span><span id="line-1765"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#maxSubGoalDepth"><span class="hs-identifier hs-type">maxSubGoalDepth</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span>
</span><span id="line-1766"></span><span id="maxSubGoalDepth"><span class="annot"><span class="annottext">maxSubGoalDepth :: SubGoalDepth -&gt; SubGoalDepth -&gt; SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#maxSubGoalDepth"><span class="hs-identifier hs-var hs-var">maxSubGoalDepth</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span> </span><span id="local-6989586621680916405"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680916405"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span> </span><span id="local-6989586621680916404"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680916404"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-var">SubGoalDepth</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680916405"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">`max`</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680916404"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1767"></span><span>
</span><span id="line-1768"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#subGoalDepthExceeded"><span class="hs-identifier hs-type">subGoalDepthExceeded</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1769"></span><span id="subGoalDepthExceeded"><span class="annot"><span class="annottext">subGoalDepthExceeded :: DynFlags -&gt; SubGoalDepth -&gt; Bool
</span><a href="GHC.Tc.Types.Constraint.html#subGoalDepthExceeded"><span class="hs-identifier hs-var hs-var">subGoalDepthExceeded</span></a></span></span><span> </span><span id="local-6989586621680916402"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680916402"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span> </span><span id="local-6989586621680916401"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680916401"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1770"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IntWithInf
</span><a href="GHC.Types.Basic.html#mkIntWithInf"><span class="hs-identifier hs-var">mkIntWithInf</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680916401"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">IntWithInf -&gt; IntWithInf -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; IntWithInf
</span><a href="GHC.Driver.Session.html#reductionDepth"><span class="hs-identifier hs-var hs-var">reductionDepth</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680916402"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1771"></span><span>
</span><span id="line-1772"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
            CtLoc
*                                                                      *
************************************************************************

The 'CtLoc' gives information about where a constraint came from.
This is important for decent error message reporting because
dictionaries don't appear in the original source code.
type will evolve...

-}</span><span>
</span><span id="line-1785"></span><span>
</span><span id="line-1786"></span><span class="hs-keyword">data</span><span> </span><span id="CtLoc"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-var">CtLoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="CtLoc"><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-var">CtLoc</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="ctl_origin"><span class="annot"><span class="annottext">CtLoc -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctl_origin"><span class="hs-identifier hs-var hs-var">ctl_origin</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#CtOrigin"><span class="hs-identifier hs-type">CtOrigin</span></a></span><span>
</span><span id="line-1787"></span><span>                   </span><span class="hs-special">,</span><span> </span><span id="ctl_env"><span class="annot"><span class="annottext">CtLoc -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctl_env"><span class="hs-identifier hs-var hs-var">ctl_env</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span>
</span><span id="line-1788"></span><span>                   </span><span class="hs-special">,</span><span> </span><span id="ctl_t_or_k"><span class="annot"><span class="annottext">CtLoc -&gt; Maybe TypeOrKind
</span><a href="GHC.Tc.Types.Constraint.html#ctl_t_or_k"><span class="hs-identifier hs-var hs-var">ctl_t_or_k</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TypeOrKind"><span class="hs-identifier hs-type">TypeOrKind</span></a></span><span>  </span><span class="hs-comment">-- OK if we're not sure</span><span>
</span><span id="line-1789"></span><span>                   </span><span class="hs-special">,</span><span> </span><span id="ctl_depth"><span class="annot"><span class="annottext">CtLoc -&gt; SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#ctl_depth"><span class="hs-identifier hs-var hs-var">ctl_depth</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1790"></span><span>
</span><span id="line-1791"></span><span>  </span><span class="hs-comment">-- The TcLclEnv includes particularly</span><span>
</span><span id="line-1792"></span><span>  </span><span class="hs-comment">--    source location:  tcl_loc   :: RealSrcSpan</span><span>
</span><span id="line-1793"></span><span>  </span><span class="hs-comment">--    context:          tcl_ctxt  :: [ErrCtxt]</span><span>
</span><span id="line-1794"></span><span>  </span><span class="hs-comment">--    binder stack:     tcl_bndrs :: TcBinderStack</span><span>
</span><span id="line-1795"></span><span>  </span><span class="hs-comment">--    level:            tcl_tclvl :: TcLevel</span><span>
</span><span id="line-1796"></span><span>
</span><span id="line-1797"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkKindLoc"><span class="hs-identifier hs-type">mkKindLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>   </span><span class="hs-comment">-- original *types* being compared</span><span>
</span><span id="line-1798"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>
</span><span id="line-1799"></span><span id="mkKindLoc"><span class="annot"><span class="annottext">mkKindLoc :: Xi -&gt; Xi -&gt; CtLoc -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#mkKindLoc"><span class="hs-identifier hs-var hs-var">mkKindLoc</span></a></span></span><span> </span><span id="local-6989586621680916393"><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916393"><span class="hs-identifier hs-var">s1</span></a></span></span><span> </span><span id="local-6989586621680916392"><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916392"><span class="hs-identifier hs-var">s2</span></a></span></span><span> </span><span id="local-6989586621680916391"><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916391"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc -&gt; CtOrigin -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#setCtLocOrigin"><span class="hs-identifier hs-var">setCtLocOrigin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtLoc -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#toKindLoc"><span class="hs-identifier hs-var">toKindLoc</span></a></span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916391"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1800"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Xi -&gt; Maybe Xi -&gt; CtOrigin -&gt; Maybe TypeOrKind -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#KindEqOrigin"><span class="hs-identifier hs-var">KindEqOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916393"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Xi -&gt; Maybe Xi
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Xi
</span><a href="#local-6989586621680916392"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtLoc -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctLocOrigin"><span class="hs-identifier hs-var">ctLocOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916391"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1801"></span><span>                                      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtLoc -&gt; Maybe TypeOrKind
</span><a href="GHC.Tc.Types.Constraint.html#ctLocTypeOrKind_maybe"><span class="hs-identifier hs-var">ctLocTypeOrKind_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916391"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1802"></span><span>
</span><span id="line-1803"></span><span class="hs-comment">-- | Take a CtLoc and moves it to the kind level</span><span>
</span><span id="line-1804"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#toKindLoc"><span class="hs-identifier hs-type">toKindLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>
</span><span id="line-1805"></span><span id="toKindLoc"><span class="annot"><span class="annottext">toKindLoc :: CtLoc -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#toKindLoc"><span class="hs-identifier hs-var hs-var">toKindLoc</span></a></span></span><span> </span><span id="local-6989586621680916389"><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916389"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916389"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_t_or_k :: Maybe TypeOrKind
</span><a href="GHC.Tc.Types.Constraint.html#ctl_t_or_k"><span class="hs-identifier hs-var">ctl_t_or_k</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TypeOrKind -&gt; Maybe TypeOrKind
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">TypeOrKind
</span><a href="GHC.Types.Basic.html#KindLevel"><span class="hs-identifier hs-var">KindLevel</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1806"></span><span>
</span><span id="line-1807"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#mkGivenLoc"><span class="hs-identifier hs-type">mkGivenLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#SkolemInfo"><span class="hs-identifier hs-type">SkolemInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>
</span><span id="line-1808"></span><span id="mkGivenLoc"><span class="annot"><span class="annottext">mkGivenLoc :: TcLevel -&gt; SkolemInfo -&gt; TcLclEnv -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#mkGivenLoc"><span class="hs-identifier hs-var hs-var">mkGivenLoc</span></a></span></span><span> </span><span id="local-6989586621680916387"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680916387"><span class="hs-identifier hs-var">tclvl</span></a></span></span><span> </span><span id="local-6989586621680916386"><span class="annot"><span class="annottext">SkolemInfo
</span><a href="#local-6989586621680916386"><span class="hs-identifier hs-var">skol_info</span></a></span></span><span> </span><span id="local-6989586621680916385"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680916385"><span class="hs-identifier hs-var">env</span></a></span></span><span>
</span><span id="line-1809"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc :: CtOrigin -&gt; TcLclEnv -&gt; Maybe TypeOrKind -&gt; SubGoalDepth -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_origin :: CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctl_origin"><span class="hs-identifier hs-var">ctl_origin</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SkolemInfo -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Origin.html#GivenOrigin"><span class="hs-identifier hs-var">GivenOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">SkolemInfo
</span><a href="#local-6989586621680916386"><span class="hs-identifier hs-var">skol_info</span></a></span><span>
</span><span id="line-1810"></span><span>          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ctl_env :: TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctl_env"><span class="hs-identifier hs-var">ctl_env</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv -&gt; TcLevel -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.html#setLclEnvTcLevel"><span class="hs-identifier hs-var">setLclEnvTcLevel</span></a></span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680916385"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680916387"><span class="hs-identifier hs-var">tclvl</span></a></span><span>
</span><span id="line-1811"></span><span>          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ctl_t_or_k :: Maybe TypeOrKind
</span><a href="GHC.Tc.Types.Constraint.html#ctl_t_or_k"><span class="hs-identifier hs-var">ctl_t_or_k</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe TypeOrKind
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>    </span><span class="hs-comment">-- this only matters for error msgs</span><span>
</span><span id="line-1812"></span><span>          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ctl_depth :: SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#ctl_depth"><span class="hs-identifier hs-var">ctl_depth</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#initialSubGoalDepth"><span class="hs-identifier hs-var">initialSubGoalDepth</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1813"></span><span>
</span><span id="line-1814"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLocEnv"><span class="hs-identifier hs-type">ctLocEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span>
</span><span id="line-1815"></span><span id="ctLocEnv"><span class="annot"><span class="annottext">ctLocEnv :: CtLoc -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctLocEnv"><span class="hs-identifier hs-var hs-var">ctLocEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctl_env"><span class="hs-identifier hs-var hs-var">ctl_env</span></a></span><span>
</span><span id="line-1816"></span><span>
</span><span id="line-1817"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLocLevel"><span class="hs-identifier hs-type">ctLocLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span>
</span><span id="line-1818"></span><span id="ctLocLevel"><span class="annot"><span class="annottext">ctLocLevel :: CtLoc -&gt; TcLevel
</span><a href="GHC.Tc.Types.Constraint.html#ctLocLevel"><span class="hs-identifier hs-var hs-var">ctLocLevel</span></a></span></span><span> </span><span id="local-6989586621680916383"><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916383"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv -&gt; TcLevel
</span><a href="GHC.Tc.Types.html#getLclEnvTcLevel"><span class="hs-identifier hs-var">getLclEnvTcLevel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CtLoc -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctLocEnv"><span class="hs-identifier hs-var">ctLocEnv</span></a></span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916383"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1819"></span><span>
</span><span id="line-1820"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLocDepth"><span class="hs-identifier hs-type">ctLocDepth</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#SubGoalDepth"><span class="hs-identifier hs-type">SubGoalDepth</span></a></span><span>
</span><span id="line-1821"></span><span id="ctLocDepth"><span class="annot"><span class="annottext">ctLocDepth :: CtLoc -&gt; SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#ctLocDepth"><span class="hs-identifier hs-var hs-var">ctLocDepth</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc -&gt; SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#ctl_depth"><span class="hs-identifier hs-var hs-var">ctl_depth</span></a></span><span>
</span><span id="line-1822"></span><span>
</span><span id="line-1823"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLocOrigin"><span class="hs-identifier hs-type">ctLocOrigin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#CtOrigin"><span class="hs-identifier hs-type">CtOrigin</span></a></span><span>
</span><span id="line-1824"></span><span id="ctLocOrigin"><span class="annot"><span class="annottext">ctLocOrigin :: CtLoc -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctLocOrigin"><span class="hs-identifier hs-var hs-var">ctLocOrigin</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctl_origin"><span class="hs-identifier hs-var hs-var">ctl_origin</span></a></span><span>
</span><span id="line-1825"></span><span>
</span><span id="line-1826"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLocSpan"><span class="hs-identifier hs-type">ctLocSpan</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#RealSrcSpan"><span class="hs-identifier hs-type">RealSrcSpan</span></a></span><span>
</span><span id="line-1827"></span><span id="ctLocSpan"><span class="annot"><span class="annottext">ctLocSpan :: CtLoc -&gt; RealSrcSpan
</span><a href="GHC.Tc.Types.Constraint.html#ctLocSpan"><span class="hs-identifier hs-var hs-var">ctLocSpan</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_env :: CtLoc -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctl_env"><span class="hs-identifier hs-var">ctl_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916382"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680916382"><span class="hs-identifier hs-var">lcl</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv -&gt; RealSrcSpan
</span><a href="GHC.Tc.Types.html#getLclEnvLoc"><span class="hs-identifier hs-var">getLclEnvLoc</span></a></span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680916382"><span class="hs-identifier hs-var">lcl</span></a></span><span>
</span><span id="line-1828"></span><span>
</span><span id="line-1829"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#ctLocTypeOrKind_maybe"><span class="hs-identifier hs-type">ctLocTypeOrKind_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TypeOrKind"><span class="hs-identifier hs-type">TypeOrKind</span></a></span><span>
</span><span id="line-1830"></span><span id="ctLocTypeOrKind_maybe"><span class="annot"><span class="annottext">ctLocTypeOrKind_maybe :: CtLoc -&gt; Maybe TypeOrKind
</span><a href="GHC.Tc.Types.Constraint.html#ctLocTypeOrKind_maybe"><span class="hs-identifier hs-var hs-var">ctLocTypeOrKind_maybe</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc -&gt; Maybe TypeOrKind
</span><a href="GHC.Tc.Types.Constraint.html#ctl_t_or_k"><span class="hs-identifier hs-var hs-var">ctl_t_or_k</span></a></span><span>
</span><span id="line-1831"></span><span>
</span><span id="line-1832"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#setCtLocSpan"><span class="hs-identifier hs-type">setCtLocSpan</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#RealSrcSpan"><span class="hs-identifier hs-type">RealSrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>
</span><span id="line-1833"></span><span id="setCtLocSpan"><span class="annot"><span class="annottext">setCtLocSpan :: CtLoc -&gt; RealSrcSpan -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#setCtLocSpan"><span class="hs-identifier hs-var hs-var">setCtLocSpan</span></a></span></span><span> </span><span id="local-6989586621680916381"><span class="annot"><span class="annottext">ctl :: CtLoc
</span><a href="#local-6989586621680916381"><span class="hs-identifier hs-var">ctl</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_env :: CtLoc -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctl_env"><span class="hs-identifier hs-var">ctl_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916380"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680916380"><span class="hs-identifier hs-var">lcl</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680916379"><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621680916379"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc -&gt; TcLclEnv -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#setCtLocEnv"><span class="hs-identifier hs-var">setCtLocEnv</span></a></span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916381"><span class="hs-identifier hs-var">ctl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcLclEnv -&gt; RealSrcSpan -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.html#setLclEnvLoc"><span class="hs-identifier hs-var">setLclEnvLoc</span></a></span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680916380"><span class="hs-identifier hs-var">lcl</span></a></span><span> </span><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621680916379"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1834"></span><span>
</span><span id="line-1835"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#bumpCtLocDepth"><span class="hs-identifier hs-type">bumpCtLocDepth</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>
</span><span id="line-1836"></span><span id="bumpCtLocDepth"><span class="annot"><span class="annottext">bumpCtLocDepth :: CtLoc -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#bumpCtLocDepth"><span class="hs-identifier hs-var hs-var">bumpCtLocDepth</span></a></span></span><span> </span><span id="local-6989586621680916378"><span class="annot"><span class="annottext">loc :: CtLoc
</span><a href="#local-6989586621680916378"><span class="hs-identifier hs-var">loc</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_depth :: CtLoc -&gt; SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#ctl_depth"><span class="hs-identifier hs-var">ctl_depth</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916377"><span class="annot"><span class="annottext">SubGoalDepth
</span><a href="#local-6989586621680916377"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916378"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_depth :: SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#ctl_depth"><span class="hs-identifier hs-var">ctl_depth</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SubGoalDepth -&gt; SubGoalDepth
</span><a href="GHC.Tc.Types.Constraint.html#bumpSubGoalDepth"><span class="hs-identifier hs-var">bumpSubGoalDepth</span></a></span><span> </span><span class="annot"><span class="annottext">SubGoalDepth
</span><a href="#local-6989586621680916377"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1837"></span><span>
</span><span id="line-1838"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#setCtLocOrigin"><span class="hs-identifier hs-type">setCtLocOrigin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#CtOrigin"><span class="hs-identifier hs-type">CtOrigin</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>
</span><span id="line-1839"></span><span id="setCtLocOrigin"><span class="annot"><span class="annottext">setCtLocOrigin :: CtLoc -&gt; CtOrigin -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#setCtLocOrigin"><span class="hs-identifier hs-var hs-var">setCtLocOrigin</span></a></span></span><span> </span><span id="local-6989586621680916376"><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916376"><span class="hs-identifier hs-var">ctl</span></a></span></span><span> </span><span id="local-6989586621680916375"><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680916375"><span class="hs-identifier hs-var">orig</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916376"><span class="hs-identifier hs-var">ctl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_origin :: CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctl_origin"><span class="hs-identifier hs-var">ctl_origin</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680916375"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1840"></span><span>
</span><span id="line-1841"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#updateCtLocOrigin"><span class="hs-identifier hs-type">updateCtLocOrigin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Origin.html#CtOrigin"><span class="hs-identifier hs-type">CtOrigin</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html#CtOrigin"><span class="hs-identifier hs-type">CtOrigin</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>
</span><span id="line-1842"></span><span id="updateCtLocOrigin"><span class="annot"><span class="annottext">updateCtLocOrigin :: CtLoc -&gt; (CtOrigin -&gt; CtOrigin) -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#updateCtLocOrigin"><span class="hs-identifier hs-var hs-var">updateCtLocOrigin</span></a></span></span><span> </span><span id="local-6989586621680916374"><span class="annot"><span class="annottext">ctl :: CtLoc
</span><a href="#local-6989586621680916374"><span class="hs-identifier hs-var">ctl</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_origin :: CtLoc -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctl_origin"><span class="hs-identifier hs-var">ctl_origin</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916373"><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680916373"><span class="hs-identifier hs-var">orig</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680916372"><span class="annot"><span class="annottext">CtOrigin -&gt; CtOrigin
</span><a href="#local-6989586621680916372"><span class="hs-identifier hs-var">upd</span></a></span></span><span>
</span><span id="line-1843"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916374"><span class="hs-identifier hs-var">ctl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_origin :: CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctl_origin"><span class="hs-identifier hs-var">ctl_origin</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; CtOrigin
</span><a href="#local-6989586621680916372"><span class="hs-identifier hs-var">upd</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680916373"><span class="hs-identifier hs-var">orig</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1844"></span><span>
</span><span id="line-1845"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#setCtLocEnv"><span class="hs-identifier hs-type">setCtLocEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span>
</span><span id="line-1846"></span><span id="setCtLocEnv"><span class="annot"><span class="annottext">setCtLocEnv :: CtLoc -&gt; TcLclEnv -&gt; CtLoc
</span><a href="GHC.Tc.Types.Constraint.html#setCtLocEnv"><span class="hs-identifier hs-var hs-var">setCtLocEnv</span></a></span></span><span> </span><span id="local-6989586621680916371"><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916371"><span class="hs-identifier hs-var">ctl</span></a></span></span><span> </span><span id="local-6989586621680916370"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680916370"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CtLoc
</span><a href="#local-6989586621680916371"><span class="hs-identifier hs-var">ctl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_env :: TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctl_env"><span class="hs-identifier hs-var">ctl_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680916370"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1847"></span><span>
</span><span id="line-1848"></span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#pprCtLoc"><span class="hs-identifier hs-type">pprCtLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1849"></span><span class="hs-comment">-- &quot;arising from ... at ...&quot;</span><span>
</span><span id="line-1850"></span><span class="hs-comment">-- Not an instance of Outputable because of the &quot;arising from&quot; prefix</span><span>
</span><span id="line-1851"></span><span id="pprCtLoc"><span class="annot"><span class="annottext">pprCtLoc :: CtLoc -&gt; SDoc
</span><a href="GHC.Tc.Types.Constraint.html#pprCtLoc"><span class="hs-identifier hs-var hs-var">pprCtLoc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Constraint.html#CtLoc"><span class="hs-identifier hs-type">CtLoc</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ctl_origin :: CtLoc -&gt; CtOrigin
</span><a href="GHC.Tc.Types.Constraint.html#ctl_origin"><span class="hs-identifier hs-var">ctl_origin</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916369"><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680916369"><span class="hs-identifier hs-var">o</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ctl_env :: CtLoc -&gt; TcLclEnv
</span><a href="GHC.Tc.Types.Constraint.html#ctl_env"><span class="hs-identifier hs-var">ctl_env</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680916368"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680916368"><span class="hs-identifier hs-var">lcl</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1852"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#sep"><span class="hs-identifier hs-var">sep</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">CtOrigin -&gt; SDoc
</span><a href="GHC.Tc.Types.Origin.html#pprCtOrigin"><span class="hs-identifier hs-var">pprCtOrigin</span></a></span><span> </span><span class="annot"><span class="annottext">CtOrigin
</span><a href="#local-6989586621680916369"><span class="hs-identifier hs-var">o</span></a></span><span>
</span><span id="line-1853"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;at&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">RealSrcSpan -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcLclEnv -&gt; RealSrcSpan
</span><a href="GHC.Tc.Types.html#getLclEnvLoc"><span class="hs-identifier hs-var">getLclEnvLoc</span></a></span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621680916368"><span class="hs-identifier hs-var">lcl</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1854"></span></pre></body></html>